Skip to content

Commit f5729b2

Browse files
committed
test(): fix update adapter http
1 parent 354fd02 commit f5729b2

File tree

5 files changed

+55
-19
lines changed

5 files changed

+55
-19
lines changed

tests/e2e/postgres-app-user.spec.ts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,26 @@
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-postgres/app/users/users.module';
44
import * as request from 'supertest';
55
import { AppModule } from '../src/apps/app-postgres/app/app.module';
6+
import {
7+
FastifyAdapter,
8+
NestFastifyApplication,
9+
} from '@nestjs/platform-fastify';
610

711
describe('[Feature] Users - /users', () => {
8-
let app: INestApplication;
12+
let app: NestFastifyApplication;
913

1014
beforeAll(async () => {
1115
const moduleFixture: TestingModule = await Test.createTestingModule({
1216
imports: [UsersModule, AppModule],
1317
}).compile();
1418

15-
app = moduleFixture.createNestApplication();
19+
app = moduleFixture.createNestApplication<NestFastifyApplication>(
20+
new FastifyAdapter(),
21+
);
1622
await app.init();
23+
await app.getHttpAdapter().getInstance().ready();
1724
});
1825

1926
it('should create a new users [POST /users]', () => {

tests/e2e/postgres-async-class.spec.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
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('Postgres (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+
);
21+
1522
await app.init();
23+
await app.getHttpAdapter().getInstance().ready();
1624
});
1725

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

tests/e2e/postgres-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('Postgres (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/postgres-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('Postgres (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/postgres.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 { 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('Postgres', () => {
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: [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)