-
Notifications
You must be signed in to change notification settings - Fork 311
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: await response middleware (#810)
- Loading branch information
1 parent
d368c16
commit 553006b
Showing
4 changed files
with
23 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { expect, test } from 'vitest' | ||
import { GraphQLClient } from '../../src/entrypoints/main.js' | ||
import { setupMockServer } from './__helpers.js' | ||
|
||
const ctx = setupMockServer() | ||
|
||
test(`throwing an error in response middleware is not swalled`, async () => { | ||
const client = new GraphQLClient(ctx.url, { | ||
// eslint-disable-next-line | ||
responseMiddleware: async () => { | ||
throw new Error(`TEST ERROR`) | ||
}, | ||
}) | ||
ctx.res() | ||
await expect(client.request(`{ me { id } }`)).rejects.toMatchInlineSnapshot(`[Error: TEST ERROR]`) | ||
}) |