File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
apps/websocket-sample/test Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ import { AppModule } from '../src/app.module';
5
5
6
6
describe ( 'AppController (e2e)' , ( ) => {
7
7
let app : INestApplication ;
8
+ let url : string ;
8
9
9
10
beforeAll ( async ( ) => {
10
11
const moduleFixture : TestingModule = await Test . createTestingModule ( {
@@ -13,17 +14,19 @@ describe('AppController (e2e)', () => {
13
14
14
15
app = moduleFixture . createNestApplication ( ) ;
15
16
await app . listen ( 0 , '0.0.0.0' ) ;
17
+ url = await app . getUrl ( ) ;
16
18
} ) ;
17
19
18
20
afterAll ( async ( ) => {
19
21
await app . close ( ) ;
20
22
} ) ;
21
23
22
- it ( 'should call message' , async ( ) => {
23
- const socket = io . connect ( await app . getUrl ( ) ) ;
24
- socket . emit ( 'message' , { name : 'Test' } , async ( data ) => {
24
+ it ( 'should call message' , ( done ) => {
25
+ const socket = io . connect ( url ) ;
26
+ socket . emit ( 'message' , { name : 'Test' } , ( data ) => {
25
27
expect ( data ) . toBe ( 'Hello, Test!' ) ;
26
28
socket . disconnect ( ) ;
29
+ done ( ) ;
27
30
} ) ;
28
31
} ) ;
29
32
} ) ;
You can’t perform that action at this time.
0 commit comments