import { PgConnection } from '@/infra/repos/postgres/helpers' ; import { IMemoryDb , newDb } from 'pg-mem' ; export const makeFakeDb = async ( entities ? ) : Promise < IMemoryDb > => { const db = newDb ( ) ; const connection = await db . adapters . createTypeormConnection ( { type : 'postgres' , entities : entities ?? [ 'src/infra/repos/postgres/entities/index.ts' ] } ) ; await connection . synchronize ( ) ; await PgConnection . getInstance ( ) . connect ( ) ; return db ; } ;