File tree Expand file tree Collapse file tree 5 files changed +55
-19
lines changed Expand file tree Collapse file tree 5 files changed +55
-19
lines changed Original file line number Diff line number Diff line change 1
- import { INestApplication , HttpStatus } from '@nestjs/common' ;
1
+ import { HttpStatus } from '@nestjs/common' ;
2
2
import { TestingModule , Test } from '@nestjs/testing' ;
3
3
import { UsersModule } from '../src/apps/app-postgres/app/users/users.module' ;
4
4
import * as request from 'supertest' ;
5
5
import { AppModule } from '../src/apps/app-postgres/app/app.module' ;
6
+ import {
7
+ FastifyAdapter ,
8
+ NestFastifyApplication ,
9
+ } from '@nestjs/platform-fastify' ;
6
10
7
11
describe ( '[Feature] Users - /users' , ( ) => {
8
- let app : INestApplication ;
12
+ let app : NestFastifyApplication ;
9
13
10
14
beforeAll ( async ( ) => {
11
15
const moduleFixture : TestingModule = await Test . createTestingModule ( {
12
16
imports : [ UsersModule , AppModule ] ,
13
17
} ) . compile ( ) ;
14
18
15
- app = moduleFixture . createNestApplication ( ) ;
19
+ app = moduleFixture . createNestApplication < NestFastifyApplication > (
20
+ new FastifyAdapter ( ) ,
21
+ ) ;
16
22
await app . init ( ) ;
23
+ await app . getHttpAdapter ( ) . getInstance ( ) . ready ( ) ;
17
24
} ) ;
18
25
19
26
it ( 'should create a new users [POST /users]' , ( ) => {
Original file line number Diff line number Diff line change 1
- import { HttpStatus , INestApplication } from '@nestjs/common' ;
1
+ import { HttpStatus } from '@nestjs/common' ;
2
2
import { Test } from '@nestjs/testing' ;
3
3
import { AsyncOptionsClassModule } from '../src/async-class-options.module' ;
4
4
import * as request from 'supertest' ;
5
+ import {
6
+ FastifyAdapter ,
7
+ NestFastifyApplication ,
8
+ } from '@nestjs/platform-fastify' ;
5
9
6
10
describe ( 'Postgres (async configuration)' , ( ) => {
7
- let app : INestApplication ;
11
+ let app : NestFastifyApplication ;
8
12
9
13
beforeAll ( async ( ) => {
10
- const module = await Test . createTestingModule ( {
14
+ const moduleFixture = await Test . createTestingModule ( {
11
15
imports : [ AsyncOptionsClassModule ] ,
12
16
} ) . compile ( ) ;
13
17
14
- app = module . createNestApplication ( ) ;
18
+ app = moduleFixture . createNestApplication < NestFastifyApplication > (
19
+ new FastifyAdapter ( ) ,
20
+ ) ;
21
+
15
22
await app . init ( ) ;
23
+ await app . getHttpAdapter ( ) . getInstance ( ) . ready ( ) ;
16
24
} ) ;
17
25
18
26
it ( `should return created entity` , ( ) => {
Original file line number Diff line number Diff line change 1
- import { HttpStatus , INestApplication } from '@nestjs/common' ;
1
+ import { HttpStatus } from '@nestjs/common' ;
2
2
import { Test } from '@nestjs/testing' ;
3
3
import { AsyncOptionsExistingModule } from '../src/async-existing-options.module' ;
4
4
import * as request from 'supertest' ;
5
+ import {
6
+ FastifyAdapter ,
7
+ NestFastifyApplication ,
8
+ } from '@nestjs/platform-fastify' ;
5
9
6
10
describe ( 'Postgres (async configuration)' , ( ) => {
7
- let app : INestApplication ;
11
+ let app : NestFastifyApplication ;
8
12
9
13
beforeAll ( async ( ) => {
10
- const module = await Test . createTestingModule ( {
14
+ const moduleFixture = await Test . createTestingModule ( {
11
15
imports : [ AsyncOptionsExistingModule ] ,
12
16
} ) . compile ( ) ;
13
17
14
- app = module . createNestApplication ( ) ;
18
+ app = moduleFixture . createNestApplication < NestFastifyApplication > (
19
+ new FastifyAdapter ( ) ,
20
+ ) ;
15
21
await app . init ( ) ;
22
+ await app . getHttpAdapter ( ) . getInstance ( ) . ready ( ) ;
16
23
} ) ;
17
24
18
25
it ( `should return created entity` , ( ) => {
Original file line number Diff line number Diff line change 1
- import { HttpStatus , INestApplication } from '@nestjs/common' ;
1
+ import { HttpStatus } from '@nestjs/common' ;
2
2
import { Test } from '@nestjs/testing' ;
3
3
import { AsyncApplicationModule } from '../src/app-async.module' ;
4
4
import * as request from 'supertest' ;
5
+ import {
6
+ FastifyAdapter ,
7
+ NestFastifyApplication ,
8
+ } from '@nestjs/platform-fastify' ;
5
9
6
10
describe ( 'Postgres (async configuration)' , ( ) => {
7
- let app : INestApplication ;
11
+ let app : NestFastifyApplication ;
8
12
9
13
beforeAll ( async ( ) => {
10
- const module = await Test . createTestingModule ( {
14
+ const moduleFixture = await Test . createTestingModule ( {
11
15
imports : [ AsyncApplicationModule ] ,
12
16
} ) . compile ( ) ;
13
17
14
- app = module . createNestApplication ( ) ;
18
+ app = moduleFixture . createNestApplication < NestFastifyApplication > (
19
+ new FastifyAdapter ( ) ,
20
+ ) ;
15
21
await app . init ( ) ;
22
+ await app . getHttpAdapter ( ) . getInstance ( ) . ready ( ) ;
16
23
} ) ;
17
24
18
25
it ( `should return created entity` , ( ) => {
Original file line number Diff line number Diff line change 1
- import { HttpStatus , INestApplication } from '@nestjs/common' ;
1
+ import { HttpStatus } from '@nestjs/common' ;
2
2
import { Test } from '@nestjs/testing' ;
3
3
import { ApplicationModule } from '../src/app.module' ;
4
4
import * as request from 'supertest' ;
5
+ import {
6
+ FastifyAdapter ,
7
+ NestFastifyApplication ,
8
+ } from '@nestjs/platform-fastify' ;
5
9
6
10
describe ( 'Postgres' , ( ) => {
7
- let app : INestApplication ;
11
+ let app : NestFastifyApplication ;
8
12
9
13
beforeAll ( async ( ) => {
10
- const module = await Test . createTestingModule ( {
14
+ const moduleFixture = await Test . createTestingModule ( {
11
15
imports : [ ApplicationModule ] ,
12
16
} ) . compile ( ) ;
13
17
14
- app = module . createNestApplication ( ) ;
18
+ app = moduleFixture . createNestApplication < NestFastifyApplication > (
19
+ new FastifyAdapter ( ) ,
20
+ ) ;
15
21
await app . init ( ) ;
22
+ await app . getHttpAdapter ( ) . getInstance ( ) . ready ( ) ;
16
23
} ) ;
17
24
18
25
it ( `should return created entity` , ( ) => {
You can’t perform that action at this time.
0 commit comments