Merge branch 'master' into codex/exiger-machineid-ou-composantid-dans-dtos
This commit is contained in:
@@ -7,6 +7,8 @@ import { PrismaService } from '../src/prisma/prisma.service';
|
||||
|
||||
describe('AppController (e2e)', () => {
|
||||
let app: INestApplication<App>;
|
||||
let prisma: PrismaService;
|
||||
|
||||
|
||||
function createMockPrismaService() {
|
||||
return {
|
||||
@@ -34,6 +36,7 @@ describe('AppController (e2e)', () => {
|
||||
beforeEach(async () => {
|
||||
prisma = createMockPrismaService();
|
||||
|
||||
|
||||
const moduleFixture: TestingModule = await Test.createTestingModule({
|
||||
imports: [AppModule],
|
||||
})
|
||||
@@ -43,6 +46,18 @@ describe('AppController (e2e)', () => {
|
||||
|
||||
app = moduleFixture.createNestApplication();
|
||||
await app.init();
|
||||
|
||||
prisma = app.get(PrismaService);
|
||||
});
|
||||
|
||||
afterAll(async () => {
|
||||
await app.close();
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await prisma.$executeRawUnsafe(
|
||||
'TRUNCATE TABLE custom_field_values, documents, pieces, composants, machines, composant_models, piece_models, type_machine_component_requirements, type_machine_piece_requirements, custom_fields, type_machines, type_composants, type_pieces, constructeurs, sites RESTART IDENTITY CASCADE',
|
||||
);
|
||||
});
|
||||
|
||||
afterEach(async () => {
|
||||
@@ -157,6 +172,7 @@ describe('AppController (e2e)', () => {
|
||||
.expect(400);
|
||||
|
||||
expect(prisma.piece.create).not.toHaveBeenCalled();
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user