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' ;
22import { TestingModule , Test } from '@nestjs/testing' ;
33import { UsersModule } from '../src/apps/app-postgres/app/users/users.module' ;
44import * as request from 'supertest' ;
55import { AppModule } from '../src/apps/app-postgres/app/app.module' ;
6+ import {
7+ FastifyAdapter ,
8+ NestFastifyApplication ,
9+ } from '@nestjs/platform-fastify' ;
610
711describe ( '[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]' , ( ) => {
Original file line number Diff line number Diff line change 1- import { HttpStatus , INestApplication } from '@nestjs/common' ;
1+ import { HttpStatus } from '@nestjs/common' ;
22import { Test } from '@nestjs/testing' ;
33import { AsyncOptionsClassModule } from '../src/async-class-options.module' ;
44import * as request from 'supertest' ;
5+ import {
6+ FastifyAdapter ,
7+ NestFastifyApplication ,
8+ } from '@nestjs/platform-fastify' ;
59
610describe ( '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` , ( ) => {
Original file line number Diff line number Diff line change 1- import { HttpStatus , INestApplication } from '@nestjs/common' ;
1+ import { HttpStatus } from '@nestjs/common' ;
22import { Test } from '@nestjs/testing' ;
33import { AsyncOptionsExistingModule } from '../src/async-existing-options.module' ;
44import * as request from 'supertest' ;
5+ import {
6+ FastifyAdapter ,
7+ NestFastifyApplication ,
8+ } from '@nestjs/platform-fastify' ;
59
610describe ( '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` , ( ) => {
Original file line number Diff line number Diff line change 1- import { HttpStatus , INestApplication } from '@nestjs/common' ;
1+ import { HttpStatus } from '@nestjs/common' ;
22import { Test } from '@nestjs/testing' ;
33import { AsyncApplicationModule } from '../src/app-async.module' ;
44import * as request from 'supertest' ;
5+ import {
6+ FastifyAdapter ,
7+ NestFastifyApplication ,
8+ } from '@nestjs/platform-fastify' ;
59
610describe ( '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` , ( ) => {
Original file line number Diff line number Diff line change 1- import { HttpStatus , INestApplication } from '@nestjs/common' ;
1+ import { HttpStatus } from '@nestjs/common' ;
22import { Test } from '@nestjs/testing' ;
33import { ApplicationModule } from '../src/app.module' ;
44import * as request from 'supertest' ;
5+ import {
6+ FastifyAdapter ,
7+ NestFastifyApplication ,
8+ } from '@nestjs/platform-fastify' ;
59
610describe ( '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` , ( ) => {
You can’t perform that action at this time.
0 commit comments