Skip to content

Commit 3e4084d

Browse files
committed
test(): fix update adapter http
1 parent 14c9ac6 commit 3e4084d

File tree

5 files changed

+52
-17
lines changed

5 files changed

+52
-17
lines changed

tests/e2e/mongodb-driver-app-user.spec.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
1-
import { INestApplication, HttpStatus } from '@nestjs/common';
1+
import { HttpStatus } from '@nestjs/common';
22
import { TestingModule, Test } from '@nestjs/testing';
33
import { UsersModule } from '../src/apps/app-mongodb/app/users/users.module';
44
import { MongoDbDriverModule } from '../../lib';
55
import * as request from 'supertest';
6+
import {
7+
FastifyAdapter,
8+
NestFastifyApplication,
9+
} from '@nestjs/platform-fastify';
610

711
describe('MongoDB Driver [Feature] Test App User - /user', () => {
8-
let app: INestApplication;
12+
let app: NestFastifyApplication;
913

1014
beforeAll(async () => {
1115
const moduleFixture: TestingModule = await Test.createTestingModule({
@@ -17,8 +21,11 @@ describe('MongoDB Driver [Feature] Test App User - /user', () => {
1721
],
1822
}).compile();
1923

20-
app = moduleFixture.createNestApplication();
24+
app = moduleFixture.createNestApplication<NestFastifyApplication>(
25+
new FastifyAdapter(),
26+
);
2127
await app.init();
28+
await app.getHttpAdapter().getInstance().ready();
2229
});
2330

2431
it('should create new user [POST /user]', () => {

tests/e2e/mongodb-driver-async-class.spec.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1-
import { HttpStatus, INestApplication } from '@nestjs/common';
1+
import { HttpStatus } from '@nestjs/common';
22
import { Test } from '@nestjs/testing';
33
import { AsyncOptionsClassModule } from '../src/async-class-options.module';
44
import * as request from 'supertest';
5+
import {
6+
FastifyAdapter,
7+
NestFastifyApplication,
8+
} from '@nestjs/platform-fastify';
59

610
describe('MongoDB driver (async configuration)', () => {
7-
let app: INestApplication;
11+
let app: NestFastifyApplication;
812

913
beforeAll(async () => {
10-
const module = await Test.createTestingModule({
14+
const moduleFixture = await Test.createTestingModule({
1115
imports: [AsyncOptionsClassModule],
1216
}).compile();
1317

14-
app = module.createNestApplication();
18+
app = moduleFixture.createNestApplication<NestFastifyApplication>(
19+
new FastifyAdapter(),
20+
);
1521
await app.init();
22+
await app.getHttpAdapter().getInstance().ready();
1623
});
1724

1825
it(`should return created entity`, () => {

tests/e2e/mongodb-driver-async-existing.spec.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1-
import { HttpStatus, INestApplication } from '@nestjs/common';
1+
import { HttpStatus } from '@nestjs/common';
22
import { Test } from '@nestjs/testing';
33
import { AsyncOptionsExistingModule } from '../src/async-existing-options.module';
44
import * as request from 'supertest';
5+
import {
6+
FastifyAdapter,
7+
NestFastifyApplication,
8+
} from '@nestjs/platform-fastify';
59

610
describe('MongoDB driver (async configuration)', () => {
7-
let app: INestApplication;
11+
let app: NestFastifyApplication;
812

913
beforeAll(async () => {
10-
const module = await Test.createTestingModule({
14+
const moduleFixture = await Test.createTestingModule({
1115
imports: [AsyncOptionsExistingModule],
1216
}).compile();
1317

14-
app = module.createNestApplication();
18+
app = moduleFixture.createNestApplication<NestFastifyApplication>(
19+
new FastifyAdapter(),
20+
);
1521
await app.init();
22+
await app.getHttpAdapter().getInstance().ready();
1623
});
1724

1825
it(`should return created entity`, () => {

tests/e2e/mongodb-driver-async.spec.ts

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,25 @@
1-
import { HttpStatus, INestApplication } from '@nestjs/common';
1+
import { HttpStatus } from '@nestjs/common';
22
import { Test } from '@nestjs/testing';
33
import { AsyncApplicationModule } from '../src/app-async.module';
44
import * as request from 'supertest';
5+
import {
6+
FastifyAdapter,
7+
NestFastifyApplication,
8+
} from '@nestjs/platform-fastify';
59

610
describe('MongoDB driver (async configuration)', () => {
7-
let app: INestApplication;
11+
let app: NestFastifyApplication;
812

913
beforeAll(async () => {
10-
const module = await Test.createTestingModule({
14+
const moduleFixture = await Test.createTestingModule({
1115
imports: [AsyncApplicationModule],
1216
}).compile();
1317

14-
app = module.createNestApplication();
18+
app = moduleFixture.createNestApplication<NestFastifyApplication>(
19+
new FastifyAdapter(),
20+
);
1521
await app.init();
22+
await app.getHttpAdapter().getInstance().ready();
1623
});
1724

1825
it(`should return created entity`, () => {

tests/e2e/mongodb-driver.spec.ts

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,24 @@ import { INestApplication } from '@nestjs/common';
22
import { Test } from '@nestjs/testing';
33
import { ApplicationModule } from '../src/app.module';
44
import * as request from 'supertest';
5+
import {
6+
FastifyAdapter,
7+
NestFastifyApplication,
8+
} from '@nestjs/platform-fastify';
59

610
describe('MongoDB driver', () => {
711
let app: INestApplication;
812

913
beforeAll(async () => {
10-
const module = await Test.createTestingModule({
14+
const moduleFixture = await Test.createTestingModule({
1115
imports: [ApplicationModule],
1216
}).compile();
1317

14-
app = module.createNestApplication();
18+
app = moduleFixture.createNestApplication<NestFastifyApplication>(
19+
new FastifyAdapter(),
20+
);
1521
await app.init();
22+
await app.getHttpAdapter().getInstance().ready();
1623
});
1724

1825
it(`should return created entity`, () => {

0 commit comments

Comments
 (0)