test: update integration test

This commit is contained in:
Kamil Myśliwiec
2024-11-21 12:46:20 +01:00
parent a3dbbecd61
commit 5c7724b649

View File

@@ -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();
}),