Skip to content

Commit

Permalink
add test for handling responses other than 2XX
Browse files Browse the repository at this point in the history
  • Loading branch information
tian-sheng-low committed Jun 22, 2023
1 parent b640451 commit ba138b9
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions packages/executors/http/tests/buildHTTPExecutor.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,23 @@ describe('buildHTTPExecutor', () => {
],
});
});
it('handle responses other than 2XX', async () => {
const executor = buildHTTPExecutor({
fetch: () => new Response(undefined, { status: 500 }),
});
const result = await executor({
document: parse(/* GraphQL */ `
query {
hello
}
`),
});
expect(result).toMatchObject({
errors: [
{
message: 'Internal Server Error',
},
],
});
});
});

0 comments on commit ba138b9

Please sign in to comment.