init fixing tests with a container for Providers needed

This commit is contained in:
Jonathan Summers-Muir committed 2023-03-28 15:40:39 +08:00
1 parent 48199a504c
commit 4e2fd74c6a
2 files changed
+16 -1

No files matched your search

@@ -3,6 +3,7 @@ import { render } from '../../../helpers'
import { waitFor, screen } from '@testing-library/react'
import { ApiReport } from 'pages/project/[ref]/reports/api-overview'
import userEvent from '@testing-library/user-event'
import Container from 'tests/setup/container'
beforeEach(() => {
// reset mocks between tests
@@ -20,7 +21,11 @@ test(`static elements`, async () => {
})
test('refresh button', async () => {
render(<ApiReport />)
render(
<Container>
<ApiReport />
</Container>
)
await waitFor(() => expect(get).toBeCalled())
get.mockReset()
userEvent.click(await screen.findByText(/Refresh/))
+10
View File
@@ -0,0 +1,10 @@
import * as Tooltip from '@radix-ui/react-tooltip'
/**
* Test renders can be wrapped in this container if it requires the Providers needed
*/
export default (props) => (
<>
<Tooltip.Provider>{props.children}</Tooltip.Provider>
</>
)