Skip to content
Snippets Groups Projects
Commit f166c555 authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

test: add content tests

parent de546f4e
No related branches found
No related tags found
1 merge request!10622.7 Release
import { render, screen, waitFor } from '@testing-library/react'
import React from 'react'
import { Provider } from 'react-redux'
import {
createMockEcolyoStore,
mockChallengeState,
mockGlobalState,
} from 'tests/__mocks__/store'
import Content from './Content'
window.scrollTo = jest.fn()
const store = createMockEcolyoStore()
describe('Content component', () => {
it('should match snapshot', async () => {
const { container } = render(
<Provider store={store}>
<Content>children</Content>
</Provider>
)
await waitFor(() => null, { container })
expect(container).toMatchSnapshot()
})
it('should be rendered with feedback modal opened', async () => {
const store = createMockEcolyoStore({
global: mockGlobalState,
challenge: mockChallengeState,
modal: { isFeedbacksOpen: true },
})
const { container } = render(
<Provider store={store}>
<Content>children</Content>
</Provider>
)
await waitFor(() => null, { container })
expect(screen.getByRole('dialog')).toBeInTheDocument()
})
})
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Content component should match snapshot 1`] = `
<div>
<div
class="content-view"
style="margin-top: 0px; padding-bottom: 0px; min-height: calc(100vh - 0px - 48px - 56px - env(safe-area-inset-top) - env(safe-area-inset-bottom) - env(safe-area-inset-bottom));"
>
children
</div>
</div>
`;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment