Skip to content

Instantly share code, notes, and snippets.

@ahayes91
Last active June 12, 2021 20:50
Show Gist options
  • Save ahayes91/43435bb66e97617c43258c3d78e815c9 to your computer and use it in GitHub Desktop.
Save ahayes91/43435bb66e97617c43258c3d78e815c9 to your computer and use it in GitHub Desktop.
Results of the integration test when the endpoints are not yet mocked to return a response.
FAIL src/App.test.js
● Console
console.error
Found an unhandled GET request to https://jsonplaceholder.typicode.com/posts
7 | onUnhandledRequest(req) {
8 | const errorMessage = `Found an unhandled ${req.method} request to ${req.url.href}`;
> 9 | console.error(errorMessage);
| ^
10 | throw errorMessage;
11 | },
12 | });
at console.error (node_modules/@testing-library/react/dist/act-compat.js:55:34)
at onUnhandledRequest (src/getAndSetupServer.js:9:17)
at onUnhandledRequest (node_modules/msw/node/lib/index.js:7565:9)
at node_modules/msw/node/lib/index.js:7630:13
at fulfilled (node_modules/msw/node/lib/index.js:50:58)
● Posts app: › renders button and mocked post in a table on button click
Unable to find role="columnheader"
<body>
<div>
<header
class="App-header"
>
<p>
Whoops! Something went wrong. Try refreshing the page!
</p>
</header>
</div>
</body>
12 | expect(button).toBeInTheDocument();
13 | userEvent.click(button);
> 14 | await screen.findByRole('columnheader', { name: 'Title'});
| ^
15 | });
16 | });
at waitForWrapper (node_modules/@testing-library/dom/dist/wait-for.js:173:27)
at findByRole (node_modules/@testing-library/dom/dist/query-helpers.js:101:33)
at Object.<anonymous> (src/App.test.js:14:18)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment