Skip to content

Commit

Permalink
fix: update testing library and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
demshy committed Oct 12, 2023
1 parent cad8145 commit 698a7c7
Show file tree
Hide file tree
Showing 4 changed files with 59 additions and 40 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
"@stylelint/postcss-css-in-js": "^0.37.2",
"@testing-library/dom": "^8.0.0",
"@testing-library/jest-dom": "^5.11.1",
"@testing-library/react": "^12.0.0",
"@testing-library/react": "^14.0.0",
"@types/common-tags": "^1.8.0",
"@types/jest": "^27.0.0",
"@types/js-base64": "^3.0.0",
Expand Down Expand Up @@ -154,7 +154,7 @@
"prettier": "^2.3.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-test-renderer": "^16.8.4",
"react-test-renderer": "^18.2.0",
"rehype": "^7.0.0",
"rimraf": "^3.0.0",
"simple-git": "^3.0.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ describe('Editor', () => {
expect(asFragment()).toMatchSnapshot();
expect(console.error).toHaveBeenCalledTimes(1);
expect(console.error).toHaveBeenCalledWith(
'Warning: Failed prop type: Required prop `entryDraft` was not specified in `Editor`.\n in Editor',
'Warning: Failed %s type: %s%s',
'prop',
'Required prop `entryDraft` was not specified in `Editor`.',
expect.anything(),
);
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from 'react';
import { fromJS } from 'immutable';
import { render, fireEvent, waitFor } from '@testing-library/react';
import { render, fireEvent, waitFor, act } from '@testing-library/react';

import { DecapCmsWidgetRelation } from '../';

Expand Down Expand Up @@ -151,12 +151,16 @@ class RelationController extends React.Component {
}

handleOnChange = jest.fn(value => {
this.setState({ ...this.state, value });
act(() => {
this.setState({ ...this.state, value });
});
});

setQueryHits = jest.fn(queryHits => {
if (this.mounted) {
this.setState({ ...this.state, queryHits });
act(() => {
this.setState({ ...this.state, queryHits });
});
}
});

Expand Down
80 changes: 46 additions & 34 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3631,6 +3631,20 @@
lz-string "^1.5.0"
pretty-format "^27.0.2"

"@testing-library/dom@^9.0.0":
version "9.3.3"
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-9.3.3.tgz#108c23a5b0ef51121c26ae92eb3179416b0434f5"
integrity sha512-fB0R+fa3AUqbLHWyxXa2kGVtf1Fe1ZZFr0Zp6AIbIAzXb2mKbEXl+PCQNUOaq5lbTab5tfctfXRNsWXxa2f7Aw==
dependencies:
"@babel/code-frame" "^7.10.4"
"@babel/runtime" "^7.12.5"
"@types/aria-query" "^5.0.1"
aria-query "5.1.3"
chalk "^4.1.0"
dom-accessibility-api "^0.5.9"
lz-string "^1.5.0"
pretty-format "^27.0.2"

"@testing-library/jest-dom@^5.11.1":
version "5.17.0"
resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-5.17.0.tgz#5e97c8f9a15ccf4656da00fecab505728de81e0c"
Expand All @@ -3646,14 +3660,14 @@
lodash "^4.17.15"
redent "^3.0.0"

"@testing-library/react@^12.0.0":
version "12.1.5"
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-12.1.5.tgz#bb248f72f02a5ac9d949dea07279095fa577963b"
integrity sha512-OfTXCJUFgjd/digLUuPxa0+/3ZxsQmE7ub9kcbW/wi96Bh3o/p5vrETcBGfP17NWPGqeYYl5LTRpwyGoMC4ysg==
"@testing-library/react@^14.0.0":
version "14.0.0"
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-14.0.0.tgz#59030392a6792450b9ab8e67aea5f3cc18d6347c"
integrity sha512-S04gSNJbYE30TlIMLTzv6QCTzt9AqIF5y6s6SzVFILNcNvbV/jU96GeiTPillGQo+Ny64M/5PV7klNYYgv5Dfg==
dependencies:
"@babel/runtime" "^7.12.5"
"@testing-library/dom" "^8.0.0"
"@types/react-dom" "<18.0.0"
"@testing-library/dom" "^9.0.0"
"@types/react-dom" "^18.0.0"

"@tootallnate/once@1":
version "1.1.2"
Expand Down Expand Up @@ -4038,12 +4052,12 @@
dependencies:
"@types/react" "*"

"@types/react-dom@<18.0.0":
version "17.0.21"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-17.0.21.tgz#85d56965483ce4850f5f03f9234e54a1f47786e5"
integrity sha512-3rQEFUNUUz2MYiRwJJj6UekcW7rFLOtmK7ajQP7qJpjNdggInl3I/xM4I3Hq1yYPdCGVMgax1gZsB7BBTtayXg==
"@types/react-dom@^18.0.0":
version "18.2.13"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.13.tgz#89cd7f9ec8b28c8b6f0392b9591671fb4a9e96b7"
integrity sha512-eJIUv7rPP+EC45uNYp/ThhSpE16k22VJUknt5OLoH9tbXoi8bMhwLf5xRuWMywamNbWzhrSmU7IBJfPup1+3fw==
dependencies:
"@types/react" "^17"
"@types/react" "*"

"@types/react-redux@^7.1.20":
version "7.1.27"
Expand Down Expand Up @@ -4078,15 +4092,6 @@
"@types/scheduler" "*"
csstype "^3.0.2"

"@types/react@^17":
version "17.0.68"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.68.tgz#99b17f567e258f5e7be855a281ac67b49a34f9f2"
integrity sha512-y8heXejd/Gi43S28GOqIFmr6BzhLa3anMlPojRu4rHh3MtRrrpB+BtLEcqP3XPO1urXByzBdkOLU7sodYWnpkA==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
csstype "^3.0.2"

"@types/redux-mock-store@^1.0.2":
version "1.0.4"
resolved "https://registry.yarnpkg.com/@types/redux-mock-store/-/redux-mock-store-1.0.4.tgz#d82d97d61314f02a3849a18edabd1a169581e632"
Expand Down Expand Up @@ -15958,21 +15963,21 @@ react-inspector@^4.0.0:
is-dom "^1.0.9"
prop-types "^15.6.1"

react-is@16.13.1, react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.4, react-is@^16.8.6:
react-is@16.13.1, react-is@^16.13.1, react-is@^16.6.0, react-is@^16.7.0, react-is@^16.8.4:
version "16.13.1"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-16.13.1.tgz#789729a4dc36de2999dc156dd6c1d9c18cea56a4"
integrity sha512-24e6ynE2H+OKt4kqsOvNd8kBpV65zoxbA4BVsEOB3ARVWQki/DHzaUoC5KuON/BiccDaCCTZBuOcfZs70kR8bQ==

"react-is@^16.12.0 || ^17.0.0 || ^18.0.0", "react-is@^17.0.1 || ^18.0.0", react-is@^18.0.0, react-is@^18.2.0:
version "18.2.0"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b"
integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==

react-is@^17.0.0, react-is@^17.0.1, react-is@^17.0.2:
version "17.0.2"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-17.0.2.tgz#e691d4a8e9c789365655539ab372762b0efb54f0"
integrity sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==

"react-is@^17.0.1 || ^18.0.0", react-is@^18.0.0:
version "18.2.0"
resolved "https://registry.yarnpkg.com/react-is/-/react-is-18.2.0.tgz#199431eeaaa2e09f86427efbb4f1473edb47609b"
integrity sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==

react-lifecycles-compat@^3.0.0, react-lifecycles-compat@^3.0.4:
version "3.0.4"
resolved "https://registry.yarnpkg.com/react-lifecycles-compat/-/react-lifecycles-compat-3.0.4.tgz#4f1a273afdfc8f3488a8c516bfda78f872352362"
Expand Down Expand Up @@ -16096,6 +16101,14 @@ react-select@^4.0.0:
react-input-autosize "^3.0.0"
react-transition-group "^4.3.0"

react-shallow-renderer@^16.15.0:
version "16.15.0"
resolved "https://registry.yarnpkg.com/react-shallow-renderer/-/react-shallow-renderer-16.15.0.tgz#48fb2cf9b23d23cde96708fe5273a7d3446f4457"
integrity sha512-oScf2FqQ9LFVQgA73vr86xl2NaOIX73rh+YFqcOp68CWj56tSfgtGKrEbyhCj0rSijyG9M1CYprTh39fBi5hzA==
dependencies:
object-assign "^4.1.1"
react-is "^16.12.0 || ^17.0.0 || ^18.0.0"

react-sizeme@^2.6.7:
version "2.6.12"
resolved "https://registry.yarnpkg.com/react-sizeme/-/react-sizeme-2.6.12.tgz#ed207be5476f4a85bf364e92042520499455453e"
Expand Down Expand Up @@ -16133,15 +16146,14 @@ react-syntax-highlighter@^11.0.2:
prismjs "^1.8.4"
refractor "^2.4.1"

react-test-renderer@^16.8.4:
version "16.14.0"
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-16.14.0.tgz#e98360087348e260c56d4fe2315e970480c228ae"
integrity sha512-L8yPjqPE5CZO6rKsKXRO/rVPiaCOy0tQQJbC+UjPNlobl5mad59lvPjwFsQHTvL03caVDIVr9x9/OSgDe6I5Eg==
react-test-renderer@^18.2.0:
version "18.2.0"
resolved "https://registry.yarnpkg.com/react-test-renderer/-/react-test-renderer-18.2.0.tgz#1dd912bd908ff26da5b9fca4fd1c489b9523d37e"
integrity sha512-JWD+aQ0lh2gvh4NM3bBM42Kx+XybOxCpgYK7F8ugAlpaTSnWsX+39Z4XkOykGZAHrjwwTZT3x3KxswVWxHPUqA==
dependencies:
object-assign "^4.1.1"
prop-types "^15.6.2"
react-is "^16.8.6"
scheduler "^0.19.1"
react-is "^18.2.0"
react-shallow-renderer "^16.15.0"
scheduler "^0.23.0"

react-textarea-autosize@^7.1.0:
version "7.1.2"
Expand Down

0 comments on commit 698a7c7

Please sign in to comment.