Skip to content

Commit

Permalink
fix jest_react
Browse files Browse the repository at this point in the history
  • Loading branch information
straker committed Aug 21, 2024
1 parent aeabc80 commit 658d184
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 25 deletions.
4 changes: 0 additions & 4 deletions doc/examples/jest_react/jest.setup.js

This file was deleted.

12 changes: 4 additions & 8 deletions doc/examples/jest_react/link.test.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
import React from 'react';
import { mount, render } from 'enzyme';
import { render } from '@testing-library/react';
import axe from 'axe-core';

import Link from './link';

test('Link has no axe violations', done => {
const fixture = document.createElement('div');
document.body.appendChild(fixture);

const linkComponent = mount(
<Link page="http://www.axe-core.org">axe website</Link>,
{ attachTo: fixture }
const { container } = render(
<Link page="http://www.axe-core.org">axe website</Link>
);

const config = {
Expand All @@ -19,7 +15,7 @@ test('Link has no axe violations', done => {
'link-in-text-block': { enabled: false }
}
};
axe.run(fixture, config, (err, { violations }) => {
axe.run(container, config, (err, { violations }) => {
expect(err).toBe(null);
expect(violations).toHaveLength(0);
done();
Expand Down
22 changes: 9 additions & 13 deletions doc/examples/jest_react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,16 @@
"test": "jest"
},
"devDependencies": {
"@babel/preset-env": "^7.20.2",
"@babel/preset-react": "^7.18.6",
"@wojtekmaj/enzyme-adapter-react-17": "^0.8.0",
"axe-core": "^4.6.2",
"enzyme": "^3.11.0",
"jest": "^29.3.1",
"jest-environment-jsdom": "^29.3.1",
"react": "^17.0.2",
"react-dom": "^17.0.2"
"@babel/preset-env": "^7.25.3",
"@babel/preset-react": "^7.24.7",
"@testing-library/jest-dom": "^6.4.8",
"@testing-library/react": "^16.0.0",
"jest": "^29.7.0",
"jest-environment-jsdom": "^29.7.0",
"react": "^18.3.1",
"react-dom": "^18.3.1"
},
"jest": {
"testEnvironment": "jsdom",
"setupFilesAfterEnv": [
"<rootDir>/jest.setup.js"
]
"testEnvironment": "jsdom"
}
}

0 comments on commit 658d184

Please sign in to comment.