11import { INestApplication } from '@nestjs/common' ;
22import { Test } from '@nestjs/testing' ;
33import { expect } from 'chai' ;
4- import * as io from 'socket.io-client' ;
4+ import { io } from 'socket.io-client' ;
55import { ApplicationGateway } from '../src/app.gateway' ;
66import { NamespaceGateway } from '../src/namespace.gateway' ;
77import { ServerGateway } from '../src/server.gateway' ;
@@ -10,7 +10,7 @@ async function createNestApp(...gateways): Promise<INestApplication> {
1010 const testingModule = await Test . createTestingModule ( {
1111 providers : gateways ,
1212 } ) . compile ( ) ;
13- const app = await testingModule . createNestApplication ( ) ;
13+ const app = testingModule . createNestApplication ( ) ;
1414 return app ;
1515}
1616
@@ -21,7 +21,7 @@ describe('WebSocketGateway', () => {
2121 app = await createNestApp ( ApplicationGateway ) ;
2222 await app . listen ( 3000 ) ;
2323
24- ws = io . connect ( 'http://localhost:8080' ) ;
24+ ws = io ( 'http://localhost:8080' ) ;
2525 ws . emit ( 'push' , {
2626 test : 'test' ,
2727 } ) ;
@@ -37,7 +37,7 @@ describe('WebSocketGateway', () => {
3737 app = await createNestApp ( ServerGateway ) ;
3838 await app . listen ( 3000 ) ;
3939
40- ws = io . connect ( 'http://localhost:3000' ) ;
40+ ws = io ( 'http://localhost:3000' ) ;
4141 ws . emit ( 'push' , {
4242 test : 'test' ,
4343 } ) ;
@@ -53,8 +53,8 @@ describe('WebSocketGateway', () => {
5353 app = await createNestApp ( ApplicationGateway , NamespaceGateway ) ;
5454 await app . listen ( 3000 ) ;
5555
56- ws = io . connect ( 'http://localhost:8080' ) ;
57- io . connect ( 'http://localhost:8080/test' ) . emit ( 'push' , { } ) ;
56+ ws = io ( 'http://localhost:8080' ) ;
57+ io ( 'http://localhost:8080/test' ) . emit ( 'push' , { } ) ;
5858 ws . emit ( 'push' , {
5959 test : 'test' ,
6060 } ) ;
0 commit comments