diff --git a/doc/examples/jest_react/jest.setup.js b/doc/examples/jest_react/jest.setup.js
deleted file mode 100644
index c07c082506..0000000000
--- a/doc/examples/jest_react/jest.setup.js
+++ /dev/null
@@ -1,4 +0,0 @@
-const Enzyme = require('enzyme');
-const Adapter = require('@wojtekmaj/enzyme-adapter-react-17');
-
-Enzyme.configure({ adapter: new Adapter() });
diff --git a/doc/examples/jest_react/link.test.js b/doc/examples/jest_react/link.test.js
index d9bd25271f..3fafe01690 100644
--- a/doc/examples/jest_react/link.test.js
+++ b/doc/examples/jest_react/link.test.js
@@ -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(
- axe website,
- { attachTo: fixture }
+ const { container } = render(
+ axe website
);
const config = {
@@ -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();
diff --git a/doc/examples/jest_react/package.json b/doc/examples/jest_react/package.json
index 0a67634b91..b4b104f089 100644
--- a/doc/examples/jest_react/package.json
+++ b/doc/examples/jest_react/package.json
@@ -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": [
- "/jest.setup.js"
- ]
+ "testEnvironment": "jsdom"
}
}