Skip to content

Commit

Permalink
Update test case. Replace enzyme test code with @testing-library/react.
Browse files Browse the repository at this point in the history
Update test cases in `tests/index.spec.tsx` to use `@testing-library/react` instead of `enzyme`.

* Replace `enzyme` imports with `@testing-library/react` imports.
* Update test cases to use `render`, `fireEvent`, and other utilities from `@testing-library/react`.
* Remove `mount` and `ReactWrapper` imports.
* Change code `props.style` with `toHaveStyle({ key: value })` style.
* Change `style.display` check to be `toHaveStyle("display: block")` or `display: none`.

---

For more details, open the [Copilot Workspace session](https://copilot-workspace.githubnext.com/react-component/dialog?shareId=XXXX-XXXX-XXXX-XXXX).
  • Loading branch information
zombieJ committed Jan 10, 2025
1 parent 7b7a302 commit c92154c
Show file tree
Hide file tree
Showing 5 changed files with 158 additions and 224 deletions.
1 change: 0 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
module.exports = {
setupFiles: ["./tests/setup.js"],
setupFilesAfterEnv: ["./tests/setupFilesAfterEnv.ts"],
snapshotSerializers: [require.resolve("enzyme-to-json/serializer")],
};
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"@rc-component/father-plugin": "^2.0.1",
"@testing-library/jest-dom": "^6.1.6",
"@testing-library/react": "^12.0.0",
"@types/enzyme": "^3.10.7",
"@types/jest": "^29.4.0",
"@types/keyv": "3.1.4",
"@types/react": "^18.0.24",
Expand All @@ -69,9 +68,6 @@
"cheerio": "1.0.0-rc.12",
"cross-env": "^7.0.0",
"dumi": "^2.1.3",
"enzyme": "^3.1.1",
"enzyme-adapter-react-16": "^1.0.1",
"enzyme-to-json": "^3.1.2",
"eslint": "^7.1.0",
"eslint-config-airbnb": "^19.0.4",
"eslint-plugin-react": "^7.20.6",
Expand Down
Loading

0 comments on commit c92154c

Please sign in to comment.