Skip to content

Instantly share code, notes, and snippets.

View a-h-i's full-sized avatar

Ahmed H. Ismail a-h-i

View GitHub Profile
@a-h-i
a-h-i / setup.ts
Created July 7, 2022 11:02 — forked from navjotahuja92/setup.ts
Nest.js Test Setup with In Memory Postgres Database (pg-mem)
// Install npm i pg-mem --save-dev
import { DataSource, Repository } from 'typeorm';
import { newDb, DataType } from 'pg-mem';
import { v4 } from 'uuid';
const setupDataSource = async () => {
const db = newDb({
autoCreateForeignKeyIndices: true,
});