Commit inicial - upload de todos os arquivos da pasta
This commit is contained in:
25
src/config/database/prisma.service.spec.ts
Normal file
25
src/config/database/prisma.service.spec.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { PrismaService } from './prisma.service';
|
||||
|
||||
describe('PrismaService', () => {
|
||||
let service: PrismaService;
|
||||
|
||||
beforeEach(() => {
|
||||
service = new PrismaService();
|
||||
jest.spyOn(service, '$connect').mockResolvedValue();
|
||||
jest.spyOn(service, '$disconnect').mockResolvedValue();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it('should call $connect on module init', async () => {
|
||||
await service.onModuleInit();
|
||||
expect(service.$connect).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('should call $disconnect on module destroy', async () => {
|
||||
await service.onModuleDestroy();
|
||||
expect(service.$disconnect).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user