Skip to content

Commit

Permalink
test(client): also expect each subscription to error out
Browse files Browse the repository at this point in the history
  • Loading branch information
enisdenjo committed Oct 18, 2021
1 parent 011d29c commit 21e44db
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/__tests__/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,8 @@ it('should close socket if connection not acknowledged', async (done) => {
});

it('should close socket with error on malformed request', async (done) => {
expect.assertions(4);

const { url } = await startTServer();

const client = createClient({
Expand All @@ -444,8 +446,6 @@ it('should close socket with error on malformed request', async (done) => {
expect((err as CloseEvent).reason).toBe(
'Syntax Error: Unexpected Name "notaquery".',
);
client.dispose();
done();
},
},
});
Expand All @@ -456,7 +456,14 @@ it('should close socket with error on malformed request', async (done) => {
},
{
next: noop,
error: noop,
error: (err) => {
expect((err as CloseEvent).code).toBe(CloseCode.InternalServerError);
expect((err as CloseEvent).reason).toBe(
'Syntax Error: Unexpected Name "notaquery".',
);
client.dispose();
done();
},
complete: noop,
},
);
Expand Down

0 comments on commit 21e44db

Please sign in to comment.