Skip to content

Commit

Permalink
Revert "chore(deps): bump @testing-library/react to v14 (#1515)" (#1523)
Browse files Browse the repository at this point in the history
* Revert "chore(deps): bump @testing-library/react to v14 (#1515)"

This reverts commit 4389297.

* test(slider): move mocks within test block
  • Loading branch information
jinlee93 authored Mar 3, 2023
1 parent 4ecfc0a commit d37798c
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 28 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@
"@storybook/testing-library": "^0.0.13",
"@storybook/testing-react": "^1.3.0",
"@testing-library/jest-dom": "^5.16.5",
"@testing-library/react": "^14.0.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^14.4.3",
"@types/jest": "^29.4.0",
"@types/lodash.debounce": "^4.0.7",
Expand Down
12 changes: 8 additions & 4 deletions src/components/Slider/Slider.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,19 @@ import Slider from './';
describe('<Slider />', () => {
generateSnapshots(stories);
describe('error throws', () => {
// expect console error from react, suppressed.
const consoleErrorMock = jest.spyOn(console, 'error');
consoleErrorMock.mockImplementation();
it('throws an error if no label or aria-label', () => {
// expect console error from react, suppressed.
const consoleErrorMock = jest.spyOn(console, 'error');
consoleErrorMock.mockImplementation();
expect(() => {
render(<Slider max={5} min={0} step={1} value={2} />);
}).toThrow(/You must provide a visible label or aria-label/);
consoleErrorMock.mockRestore();
});
it('throws an error if told to generate markers, but steps are not integers', () => {
// expect console error from react, suppressed.
const consoleErrorMock = jest.spyOn(console, 'error');
consoleErrorMock.mockImplementation();
expect(() => {
render(
<Slider
Expand All @@ -30,7 +34,7 @@ describe('<Slider />', () => {
}).toThrow(
/Number of markers is not an integer. Change step or supply custom markers/,
);
consoleErrorMock.mockRestore();
});
consoleErrorMock.mockRestore();
});
});
30 changes: 7 additions & 23 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1672,7 +1672,7 @@ __metadata:
"@storybook/testing-library": ^0.0.13
"@storybook/testing-react": ^1.3.0
"@testing-library/jest-dom": ^5.16.5
"@testing-library/react": ^14.0.0
"@testing-library/react": ^13.4.0
"@testing-library/user-event": ^14.4.3
"@tippyjs/react": ^4.2.6
"@types/jest": ^29.4.0
Expand Down Expand Up @@ -4274,7 +4274,7 @@ __metadata:
languageName: node
linkType: hard

"@testing-library/dom@npm:^8.3.0":
"@testing-library/dom@npm:^8.3.0, @testing-library/dom@npm:^8.5.0":
version: 8.20.0
resolution: "@testing-library/dom@npm:8.20.0"
dependencies:
Expand All @@ -4290,22 +4290,6 @@ __metadata:
languageName: node
linkType: hard

"@testing-library/dom@npm:^9.0.0":
version: 9.0.0
resolution: "@testing-library/dom@npm:9.0.0"
dependencies:
"@babel/code-frame": ^7.10.4
"@babel/runtime": ^7.12.5
"@types/aria-query": ^5.0.1
aria-query: ^5.0.0
chalk: ^4.1.0
dom-accessibility-api: ^0.5.9
lz-string: ^1.4.4
pretty-format: ^27.0.2
checksum: 5381bf9438f0ee35f795e7f9b203564aa455e7cd838b6677084c82dd56396779c38cc49ddffed4e57a8bcc3c62b4bc96ea684bb4b24d13655152db745327b2cd
languageName: node
linkType: hard

"@testing-library/jest-dom@npm:^5.16.5":
version: 5.16.5
resolution: "@testing-library/jest-dom@npm:5.16.5"
Expand All @@ -4323,17 +4307,17 @@ __metadata:
languageName: node
linkType: hard

"@testing-library/react@npm:^14.0.0":
version: 14.0.0
resolution: "@testing-library/react@npm:14.0.0"
"@testing-library/react@npm:^13.4.0":
version: 13.4.0
resolution: "@testing-library/react@npm:13.4.0"
dependencies:
"@babel/runtime": ^7.12.5
"@testing-library/dom": ^9.0.0
"@testing-library/dom": ^8.5.0
"@types/react-dom": ^18.0.0
peerDependencies:
react: ^18.0.0
react-dom: ^18.0.0
checksum: 4a54c8f56cc4a39b50803205f84f06280bb76521d6d5d4b3b36651d760c7c7752ef142d857d52aaf4fad4848ed7a8be49afc793a5dda105955d2f8bef24901ac
checksum: 51ec548c1fdb1271089a5c63e0908f0166f2c7fcd9cacd3108ebbe0ce64cb4351812d885892020dc37608418cfb15698514856502b3cab0e5cc58d6cc1bd4a3e
languageName: node
linkType: hard

Expand Down

0 comments on commit d37798c

Please sign in to comment.