mirror of
https://github.com/nestjs/nest.git
synced 2026-02-21 23:11:44 +00:00
test: update integration test
This commit is contained in:
@@ -11,20 +11,27 @@ describe('ErrorGateway', () => {
|
||||
const testingModule = await Test.createTestingModule({
|
||||
providers: [ErrorGateway],
|
||||
}).compile();
|
||||
app = await testingModule.createNestApplication();
|
||||
|
||||
app = testingModule.createNestApplication();
|
||||
await app.listen(3000);
|
||||
});
|
||||
|
||||
it(`should handle error`, async () => {
|
||||
const ws = io('http://localhost:8080');
|
||||
ws.emit('push', {
|
||||
test: 'test',
|
||||
});
|
||||
const pattern = 'push';
|
||||
const data = { test: 'test' };
|
||||
|
||||
ws.emit(pattern, data);
|
||||
|
||||
await new Promise<void>(resolve =>
|
||||
ws.on('exception', data => {
|
||||
expect(data).to.be.eql({
|
||||
status: 'error',
|
||||
message: 'test',
|
||||
cause: {
|
||||
pattern,
|
||||
data,
|
||||
},
|
||||
});
|
||||
resolve();
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user