-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Tests were broken after adding @patternfly/virtual-assistant. I updated the jest config to handle it.
- Loading branch information
1 parent
ea5cbc0
commit b6c357c
Showing
8 changed files
with
1,978 additions
and
447 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
module.exports = { | ||
presets: [ | ||
['@babel/preset-env', { targets: { node: 'current' } }], | ||
['@babel/preset-react', { runtime: 'automatic' }], | ||
'@babel/preset-typescript', | ||
], | ||
}; |
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
Large diffs are not rendered by default.
Oops, something went wrong.
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,14 @@ | ||
import React from 'react'; | ||
import { render } from '@testing-library/react'; | ||
import '@testing-library/jest-dom'; | ||
import { BaseChatbot } from './BaseChatbot'; | ||
import { createMemoryRouter, RouterProvider } from 'react-router-dom'; | ||
|
||
describe('Base chatbot', () => { | ||
it('should be able to snapshot', () => { | ||
const router = createMemoryRouter([{ path: '/', element: <BaseChatbot /> }], { initialEntries: ['/'] }); | ||
|
||
const { container } = render(<RouterProvider router={router} />); | ||
expect(container).toMatchSnapshot(); | ||
}); | ||
}); |
68 changes: 68 additions & 0 deletions
68
src/app/BaseChatbot/__snapshots__/BaseChatbot.test.tsx.snap
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,68 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`Base chatbot should be able to snapshot 1`] = ` | ||
<div> | ||
<h2> | ||
Unexpected Application Error! | ||
</h2> | ||
<h3 | ||
style="font-style: italic;" | ||
> | ||
Cannot destructure property 'chatbots' of '(0 , _reactRouterDom.useLoaderData)(...)' as it is undefined. | ||
</h3> | ||
<pre | ||
style="padding: 0.5rem; background-color: rgba(200, 200, 200, 0.5);" | ||
> | ||
TypeError: Cannot destructure property 'chatbots' of '(0 , _reactRouterDom.useLoaderData)(...)' as it is undefined. | ||
at chatbots (/Users/ralpert/Documents/chatbot-ui/src/app/BaseChatbot/BaseChatbot.tsx:51:11) | ||
at renderWithHooks (/Users/ralpert/Documents/chatbot-ui/node_modules/react-dom/cjs/react-dom.development.js:15486:18) | ||
at mountIndeterminateComponent (/Users/ralpert/Documents/chatbot-ui/node_modules/react-dom/cjs/react-dom.development.js:20103:13) | ||
at beginWork (/Users/ralpert/Documents/chatbot-ui/node_modules/react-dom/cjs/react-dom.development.js:21626:16) | ||
at beginWork$1 (/Users/ralpert/Documents/chatbot-ui/node_modules/react-dom/cjs/react-dom.development.js:27465:14) | ||
at performUnitOfWork (/Users/ralpert/Documents/chatbot-ui/node_modules/react-dom/cjs/react-dom.development.js:26599:12) | ||
at workLoopSync (/Users/ralpert/Documents/chatbot-ui/node_modules/react-dom/cjs/react-dom.development.js:26505:5) | ||
at renderRootSync (/Users/ralpert/Documents/chatbot-ui/node_modules/react-dom/cjs/react-dom.development.js:26473:7) | ||
at recoverFromConcurrentError (/Users/ralpert/Documents/chatbot-ui/node_modules/react-dom/cjs/react-dom.development.js:25889:20) | ||
at performConcurrentWorkOnRoot (/Users/ralpert/Documents/chatbot-ui/node_modules/react-dom/cjs/react-dom.development.js:25789:22) | ||
at flushActQueue (/Users/ralpert/Documents/chatbot-ui/node_modules/react/cjs/react.development.js:2667:24) | ||
at act (/Users/ralpert/Documents/chatbot-ui/node_modules/react/cjs/react.development.js:2582:11) | ||
at /Users/ralpert/Documents/chatbot-ui/node_modules/@testing-library/react/dist/act-compat.js:47:25 | ||
at renderRoot (/Users/ralpert/Documents/chatbot-ui/node_modules/@testing-library/react/dist/pure.js:180:26) | ||
at render (/Users/ralpert/Documents/chatbot-ui/node_modules/@testing-library/react/dist/pure.js:271:10) | ||
at Object.<anonymous> (/Users/ralpert/Documents/chatbot-ui/src/app/BaseChatbot/BaseChatbot.test.tsx:11:33) | ||
at Promise.then.completed (/Users/ralpert/Documents/chatbot-ui/node_modules/jest-circus/build/utils.js:298:28) | ||
at new Promise (<anonymous>) | ||
at callAsyncCircusFn (/Users/ralpert/Documents/chatbot-ui/node_modules/jest-circus/build/utils.js:231:10) | ||
at _callCircusTest (/Users/ralpert/Documents/chatbot-ui/node_modules/jest-circus/build/run.js:316:40) | ||
at processTicksAndRejections (node:internal/process/task_queues:95:5) | ||
at _runTest (/Users/ralpert/Documents/chatbot-ui/node_modules/jest-circus/build/run.js:252:3) | ||
at _runTestsForDescribeBlock (/Users/ralpert/Documents/chatbot-ui/node_modules/jest-circus/build/run.js:126:9) | ||
at _runTestsForDescribeBlock (/Users/ralpert/Documents/chatbot-ui/node_modules/jest-circus/build/run.js:121:9) | ||
at run (/Users/ralpert/Documents/chatbot-ui/node_modules/jest-circus/build/run.js:71:3) | ||
at runAndTransformResultsToJestFormat (/Users/ralpert/Documents/chatbot-ui/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapterInit.js:122:21) | ||
at jestAdapter (/Users/ralpert/Documents/chatbot-ui/node_modules/jest-circus/build/legacy-code-todo-rewrite/jestAdapter.js:79:19) | ||
at runTestInternal (/Users/ralpert/Documents/chatbot-ui/node_modules/jest-runner/build/runTest.js:367:16) | ||
at runTest (/Users/ralpert/Documents/chatbot-ui/node_modules/jest-runner/build/runTest.js:444:34) | ||
at Object.worker (/Users/ralpert/Documents/chatbot-ui/node_modules/jest-runner/build/testWorker.js:106:12) | ||
</pre> | ||
<p> | ||
💿 Hey developer 👋 | ||
</p> | ||
<p> | ||
You can provide a way better UX than this when your app throws errors by providing your own | ||
<code | ||
style="padding: 2px 4px; background-color: rgba(200, 200, 200, 0.5);" | ||
> | ||
ErrorBoundary | ||
</code> | ||
or | ||
<code | ||
style="padding: 2px 4px; background-color: rgba(200, 200, 200, 0.5);" | ||
> | ||
errorElement | ||
</code> | ||
prop on your route. | ||
</p> | ||
</div> | ||
`; |
Oops, something went wrong.