Skip to content

Commit 128ee93

Browse files
committed
Slightly simplified e2e tests
1 parent 26a5a7a commit 128ee93

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

test/auth.e2e-spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {ExecutionContext, INestApplication} from "@nestjs/common";
2-
import {Test, TestingModule} from "@nestjs/testing";
2+
import {Test} from "@nestjs/testing";
33
import {Request} from "express";
44
import * as request from "supertest";
55

@@ -13,7 +13,7 @@ describe("AuthController (e2e)", () => {
1313
const AUTH_URL = "/api/auth";
1414

1515
beforeEach(async () => {
16-
const moduleFixture: TestingModule = await Test.createTestingModule({
16+
const moduleRef = await Test.createTestingModule({
1717
imports: [AuthModule]
1818
})
1919
.overrideGuard(JwtAuthGuard)
@@ -26,7 +26,7 @@ describe("AuthController (e2e)", () => {
2626
})
2727
.compile();
2828

29-
app = moduleFixture.createNestApplication();
29+
app = moduleRef.createNestApplication();
3030
app.setGlobalPrefix("api");
3131

3232
await app.init();

test/booking.e2e-spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {ExecutionContext, INestApplication, ValidationPipe} from "@nestjs/common";
2-
import {Test, TestingModule} from "@nestjs/testing";
2+
import {Test} from "@nestjs/testing";
33
import {BookingStatus} from "@prisma/client";
44
import {Request} from "express";
55
import * as request from "supertest";
@@ -18,7 +18,7 @@ describe("BookingController (e2e)", () => {
1818
const BOOKING_URL = "/api/booking";
1919

2020
beforeAll(async () => {
21-
const moduleFixture: TestingModule = await Test.createTestingModule({
21+
const moduleRef = await Test.createTestingModule({
2222
imports: [AppModule]
2323
})
2424
.overrideGuard(JwtAuthGuard)
@@ -31,8 +31,8 @@ describe("BookingController (e2e)", () => {
3131
})
3232
.compile();
3333

34-
app = moduleFixture.createNestApplication();
35-
prismaService = moduleFixture.get<PrismaService>(PrismaService);
34+
app = moduleRef.createNestApplication();
35+
prismaService = moduleRef.get<PrismaService>(PrismaService);
3636

3737
app.useGlobalPipes(new ValidationPipe({transform: true, whitelist: true}));
3838
app.setGlobalPrefix("api");

test/location.e2e-spec.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {ExecutionContext, INestApplication, ValidationPipe} from "@nestjs/common";
2-
import {Test, TestingModule} from "@nestjs/testing";
2+
import {Test} from "@nestjs/testing";
33
import {Request} from "express";
44
import * as request from "supertest";
55

@@ -15,7 +15,7 @@ describe("LocationController (e2e)", () => {
1515
const LOCATION_URL = "/api/location";
1616

1717
beforeAll(async () => {
18-
const moduleFixture: TestingModule = await Test.createTestingModule({
18+
const moduleRef = await Test.createTestingModule({
1919
imports: [AppModule]
2020
})
2121
.overrideGuard(JwtAuthGuard)
@@ -28,7 +28,7 @@ describe("LocationController (e2e)", () => {
2828
})
2929
.compile();
3030

31-
app = moduleFixture.createNestApplication();
31+
app = moduleRef.createNestApplication();
3232

3333
app.useGlobalPipes(new ValidationPipe({transform: true, whitelist: true}));
3434
app.setGlobalPrefix("api");

test/service.e2e-spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {ExecutionContext, INestApplication, ValidationPipe} from "@nestjs/common";
2-
import {Test, TestingModule} from "@nestjs/testing";
2+
import {Test} from "@nestjs/testing";
33
import {Request} from "express";
44
import * as request from "supertest";
55

@@ -17,7 +17,7 @@ describe("ServiceController (e2e)", () => {
1717
const SERVICE_URL = "/api/service";
1818

1919
beforeAll(async () => {
20-
const moduleFixture: TestingModule = await Test.createTestingModule({
20+
const moduleRef = await Test.createTestingModule({
2121
imports: [AppModule]
2222
})
2323
.overrideGuard(JwtAuthGuard)
@@ -30,8 +30,8 @@ describe("ServiceController (e2e)", () => {
3030
})
3131
.compile();
3232

33-
app = moduleFixture.createNestApplication();
34-
prismaService = moduleFixture.get<PrismaService>(PrismaService);
33+
app = moduleRef.createNestApplication();
34+
prismaService = moduleRef.get<PrismaService>(PrismaService);
3535

3636
app.useGlobalPipes(new ValidationPipe({transform: true, whitelist: true}));
3737
app.setGlobalPrefix("api");

test/user.e2e-spec.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import {ExecutionContext, INestApplication, ValidationPipe} from "@nestjs/common";
2-
import {Test, TestingModule} from "@nestjs/testing";
2+
import {Test} from "@nestjs/testing";
33
import {Request} from "express";
44
import * as request from "supertest";
55

@@ -16,7 +16,7 @@ describe("UserController (e2e)", () => {
1616
const USER_URL = "/api/user";
1717

1818
beforeAll(async () => {
19-
const moduleFixture: TestingModule = await Test.createTestingModule({
19+
const moduleRef = await Test.createTestingModule({
2020
imports: [AppModule]
2121
})
2222
.overrideGuard(JwtAuthGuard)
@@ -29,8 +29,8 @@ describe("UserController (e2e)", () => {
2929
})
3030
.compile();
3131

32-
app = moduleFixture.createNestApplication();
33-
prismaService = moduleFixture.get<PrismaService>(PrismaService);
32+
app = moduleRef.createNestApplication();
33+
prismaService = moduleRef.get<PrismaService>(PrismaService);
3434

3535
app.useGlobalPipes(new ValidationPipe({transform: true, whitelist: true}));
3636
app.setGlobalPrefix("api");

0 commit comments

Comments
 (0)