Skip to content

Commit

Permalink
Update version of react used in tests to same as production (#1917)
Browse files Browse the repository at this point in the history
* update version of react used in tests

* upgrade test version of react to 19, same major as prod
  • Loading branch information
ChristopherChudzicki authored Dec 19, 2024
1 parent 51bdf22 commit e57d5b2
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 31 deletions.
2 changes: 1 addition & 1 deletion frontends/api/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"./test-utils": "./src/test-utils/index.ts"
},
"peerDependencies": {
"react": "18.3.1"
"react": "^19"
},
"devDependencies": {
"@faker-js/faker": "^9.0.0",
Expand Down
8 changes: 4 additions & 4 deletions frontends/main/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
"ol-components": "0.0.0",
"ol-utilities": "0.0.0",
"posthog-js": "^1.157.2",
"react": "^18",
"react-dom": "^18",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-slick": "^0.30.2",
"slick-carousel": "^1.8.1",
"tiny-invariant": "^1.3.3",
Expand All @@ -40,8 +40,8 @@
"@types/jest": "^29.5.12",
"@types/lodash": "^4.17.7",
"@types/node": "^22.0.0",
"@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"@types/react": "^19",
"@types/react-dom": "^19",
"@types/react-slick": "^0.23.13",
"@types/slick-carousel": "^1",
"eslint": "8.57.1",
Expand Down
10 changes: 3 additions & 7 deletions frontends/main/src/app-pages/ChannelPage/ChannelPage.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
setMockResponse,
waitFor,
renderWithProviders,
expectLastProps,
} from "@/test-utils"
import ChannelSearch from "./ChannelSearch"
import { assertHeadings, getByImageSrc } from "ol-test-utilities"
Expand Down Expand Up @@ -176,18 +177,13 @@ describe.each(ALL_CHANNEL_TYPES)(
setupTopicApis(channel)
}
await screen.findAllByText(channel.title)
const expectedProps = expect.objectContaining({

expectLastProps(mockedChannelSearch, {
constantSearchParams: {
platform: ["ocw", "mitxonline"],
department: ["8", "9"],
},
})
const expectedContext = expect.anything()

expect(mockedChannelSearch).toHaveBeenLastCalledWith(
expectedProps,
expectedContext,
)
}, 10000)
it("Does not display the channel search if search_filter is undefined", async () => {
const { channel } = setupApis({
Expand Down
4 changes: 2 additions & 2 deletions frontends/main/src/test-utils/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const expectProps = (
) => {
expect(fc).toHaveBeenCalledWith(
expect.objectContaining(partialProps),
expect.anything(),
expect.toBeOneOf([expect.anything(), undefined]),
)
}

Expand All @@ -124,7 +124,7 @@ const expectLastProps = (
) => {
expect(fc).toHaveBeenLastCalledWith(
expect.objectContaining(partialProps),
expect.anything(),
expect.toBeOneOf([expect.anything(), undefined]),
)
}

Expand Down
6 changes: 3 additions & 3 deletions frontends/ol-components/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"@mui/system": "^6.1.6",
"@remixicon/react": "^4.2.0",
"@testing-library/dom": "^10.4.0",
"@types/react-dom": "^18.3.0",
"@types/react-dom": "^19",
"@types/tinycolor2": "^1.4.6",
"api": "workspace:*",
"classnames": "^2.5.1",
Expand All @@ -34,8 +34,8 @@
"next": "^15.0.2",
"ol-test-utilities": "0.0.0",
"ol-utilities": "0.0.0",
"react": "18.3.1",
"react-dom": "^18.3.1",
"react": "^19.0.0",
"react-dom": "^19.0.0",
"react-router": "^6.22.2",
"react-router-dom": "^6.22.2",
"react-select": "^5.7.7",
Expand Down
4 changes: 2 additions & 2 deletions frontends/ol-utilities/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"./test-utils/factories": "./src/test-utils/factories.ts"
},
"peerDependencies": {
"next": "^14.2.15",
"react": "18.3.1"
"next": "^15",
"react": "19"
},
"sideEffects": false,
"dependencies": {
Expand Down
49 changes: 37 additions & 12 deletions yarn.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit e57d5b2

Please sign in to comment.