Skip to content

Commit

Permalink
commit
Browse files Browse the repository at this point in the history
  • Loading branch information
nitinawari committed Jan 21, 2025
1 parent 460b5cb commit b8d7e61
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions frontend/__tests__/src/Accessibility.test.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { render, waitFor } from '@testing-library/react'
// Accessibility.test.tsx
import { render, waitFor, act } from '@testing-library/react'
import App from 'App'
import { axe, toHaveNoViolations } from 'jest-axe'
import React from 'react'
Expand All @@ -19,9 +20,13 @@ describe('Accessibility Tests', () => {
jest.setTimeout(30000)

it('App should have no accessibility violations', async () => {
const { container } = renderWithRouter(App)

await waitFor(() => container)
let container;

await act(async () => {
const rendered = renderWithRouter(App)
container = rendered.container
await waitFor(() => container)
})

const results = await axe(container)
expect(results).toHaveNoViolations()
Expand All @@ -33,9 +38,13 @@ describe('Accessibility Tests', () => {

describe.each(pages)('Testing individual pages', ({ component: PageComponent, name }) => {
it(`${name} should have no accessibility violations`, async () => {
const { container } = renderWithRouter(PageComponent)

await waitFor(() => container)
let container;

await act(async () => {
const rendered = renderWithRouter(PageComponent)
container = rendered.container
await waitFor(() => container)
})

const results = await axe(container)
expect(results).toHaveNoViolations()
Expand Down

0 comments on commit b8d7e61

Please sign in to comment.