Skip to content

Commit

Permalink
Update tests to use React Testing Library (#100)
Browse files Browse the repository at this point in the history
The test needs to be refactored and improved, but in the meantime
the changes in the commit will allow us to move away from Enzyme.
  • Loading branch information
jho406 authored Oct 8, 2024
1 parent cabc118 commit 272f445
Show file tree
Hide file tree
Showing 8 changed files with 134 additions and 97 deletions.
6 changes: 2 additions & 4 deletions superglue/lib/action_creators/requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,7 @@ export const remote: RemoteCreator = (
headers,
body,
pageKey: rawPageKey,
beforeSave = (prevPage: Page, receivedPage: PageResponse) =>
receivedPage,
beforeSave = (prevPage: Page, receivedPage: PageResponse) => receivedPage,
} = {}
) => {
path = withoutBusters(path)
Expand Down Expand Up @@ -170,8 +169,7 @@ export const visit: VisitCreator = (
headers,
body,
placeholderKey,
beforeSave = (prevPage: Page, receivedPage: PageResponse) =>
receivedPage,
beforeSave = (prevPage: Page, receivedPage: PageResponse) => receivedPage,
revisit = false,
} = {}
) => {
Expand Down
5 changes: 5 additions & 0 deletions superglue/lib/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,11 @@ interface ApplicationProps {
* to setup UJS helpers.
*/
appEl: HTMLElement
/**
* A store to perform setup on. If none is provided, it will build a basic
* store.
*/
store?: SuperglueStore
}

type ConnectedMapping = Record<
Expand Down
10 changes: 6 additions & 4 deletions superglue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,14 +46,16 @@
"homepage": "https://github.com/thoughtbot/superglue#readme",
"devDependencies": {
"@reduxjs/toolkit": "^2.2.5",
"@testing-library/dom": "^10.4.0",
"@testing-library/jest-dom": "^6.5.0",
"@testing-library/react": "^16.0.1",
"@testing-library/user-event": "^14.5.2",
"@types/url-parse": "^1.4.11",
"@typescript-eslint/eslint-plugin": "^7.15.0",
"@typescript-eslint/parser": "^7.15.0",
"@vitejs/plugin-react": "^4.3.1",
"@vitest/coverage-v8": "^2.0.2",
"abortcontroller-polyfill": "^1.7.3",
"enzyme": "^3.11.0",
"enzyme-adapter-react-16": "^1.15.6",
"eslint": "^8.57.0",
"eslint-plugin-react": "^7.34.3",
"fetch-headers": "^2.0.0",
Expand All @@ -63,8 +65,8 @@
"npm-run-all": "^4.1.5",
"prettier": "^2.3.1",
"prettier-eslint": "^16.3.0",
"react": "^16.4.0",
"react-dom": "^16.4.0",
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-redux": "^7.2.4",
"redux": "^5.0.1",
"redux-mock-store": "^1.5.4",
Expand Down
Loading

0 comments on commit 272f445

Please sign in to comment.