Skip to content

Commit

Permalink
updated error test
Browse files Browse the repository at this point in the history
  • Loading branch information
shewood committed Oct 17, 2023
1 parent 16ecf9f commit d71ec66
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions __tests__/components/ErrorPage.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @jest-environment jsdom
*/

import { render } from '@testing-library/react'
import { render, act, waitFor } from '@testing-library/react'
import '@testing-library/jest-dom/extend-expect'
import { ErrorPage } from '../../components/ErrorPage.js'
import { axe, toHaveNoViolations } from 'jest-axe'
Expand All @@ -12,19 +12,31 @@ expect.extend(toHaveNoViolations)
describe('Error Pages', () => {
it('has no a11y violations 404', async () => {
const { container } = render(<ErrorPage lang="en" errType="404" isAuth />)
const results = await axe(container)
expect(results).toHaveNoViolations()
await act(async () => {
const results = await axe(container)
await waitFor(() => {
expect(results).toHaveNoViolations()
})
})
})

it('has no a11y violations 500', async () => {
const { container } = render(<ErrorPage lang="en" errType="500" isAuth />)
const results = await axe(container)
expect(results).toHaveNoViolations()
await act(async () => {
const results = await axe(container)
await waitFor(() => {
expect(results).toHaveNoViolations()
})
})
})

it('has no a11y violations 503', async () => {
const { container } = render(<ErrorPage lang="en" errType="503" isAuth />)
const results = await axe(container)
expect(results).toHaveNoViolations()
await act(async () => {
const results = await axe(container)
await waitFor(() => {
expect(results).toHaveNoViolations()
})
})
})
})

0 comments on commit d71ec66

Please sign in to comment.