Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
iddan committed Dec 30, 2024
1 parent eadcbeb commit eb3b11b
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 36 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,11 @@
"@storybook/react-webpack5": "^8.4.7",
"@storybook/test": "^8.4.7",
"@testing-library/jest-dom": "^5.14.1",
"@testing-library/react": "^12.0.0",
"@testing-library/react": "^16.1.0",
"@types/array.prototype.flatmap": "^1.2.2",
"@types/node": "^16.7.10",
"@types/react": "^18.0.0",
"@types/react-dom": "^18.0.0",
"@types/react-select": "^3.0.26",
"@typescript-eslint/eslint-plugin": "^6.5.0",
"@typescript-eslint/parser": "^6.5.0",
Expand Down
12 changes: 6 additions & 6 deletions src/ActiveCell.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
*/

import * as React from "react";
import { fireEvent, render } from "@testing-library/react";
import { render, fireEvent } from "@testing-library/react";
import * as Point from "./point";
import * as Types from "./types";
import * as Actions from "./actions";
Expand Down Expand Up @@ -66,7 +66,7 @@ describe("<ActiveCell />", () => {
const activeCell = document.querySelector(".Spreadsheet__active-cell");
expect(activeCell).not.toBeNull();
expect(activeCell).toHaveClass("Spreadsheet__active-cell--edit");
expect(MOCK_DATA_EDITOR).toBeCalledTimes(1);
expect(MOCK_DATA_EDITOR).toBeCalledTimes(2);
expect(MOCK_DATA_EDITOR).toBeCalledWith(
{
row: Point.ORIGIN.row,
Expand All @@ -79,7 +79,7 @@ describe("<ActiveCell />", () => {
);
});
test("calls setCellData if value changed", () => {
const { rerender } = render(
render(
<context.Provider
value={[{ ...STATE_WITH_ACTIVE, mode: "edit" }, DISPATCH_MOCK]}
>
Expand All @@ -98,7 +98,7 @@ describe("<ActiveCell />", () => {
value: "test",
})
);
rerender(
render(
<context.Provider
value={[{ ...STATE_WITH_ACTIVE, mode: "view" }, DISPATCH_MOCK]}
>
Expand All @@ -108,7 +108,7 @@ describe("<ActiveCell />", () => {
expect(activeCell).not.toHaveClass("Spreadsheet__active-cell--edit");
});
test("doesn't call setCellData if value not changed", () => {
const { rerender } = render(
render(
<context.Provider
value={[{ ...STATE_WITH_ACTIVE, mode: "edit" }, DISPATCH_MOCK]}
>
Expand All @@ -118,7 +118,7 @@ describe("<ActiveCell />", () => {
const activeCell = document.querySelector(".Spreadsheet__active-cell");
expect(activeCell).not.toBeNull();
expect(activeCell).toHaveClass("Spreadsheet__active-cell--edit");
rerender(
render(
<context.Provider
value={[{ ...STATE_WITH_ACTIVE, mode: "view" }, DISPATCH_MOCK]}
>
Expand Down
38 changes: 9 additions & 29 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2393,20 +2393,6 @@
lz-string "^1.5.0"
pretty-format "^27.0.2"

"@testing-library/dom@^8.0.0":
version "8.5.0"
resolved "https://registry.yarnpkg.com/@testing-library/dom/-/dom-8.5.0.tgz#56e31331015f943a68c6ec27e259fdf16c69ab7d"
integrity sha512-O0fmHFaPlqaYCpa/cBL0cvroMridb9vZsMLacgIqrlxj+fd+bGF8UfAgwsLCHRF84KLBafWlm9CuOvxeNTlodw==
dependencies:
"@babel/code-frame" "^7.10.4"
"@babel/runtime" "^7.12.5"
"@types/aria-query" "^4.2.0"
aria-query "^4.2.2"
chalk "^4.1.0"
dom-accessibility-api "^0.5.6"
lz-string "^1.4.4"
pretty-format "^27.0.2"

"@testing-library/[email protected]":
version "6.5.0"
resolved "https://registry.yarnpkg.com/@testing-library/jest-dom/-/jest-dom-6.5.0.tgz#50484da3f80fb222a853479f618a9ce5c47bfe54"
Expand Down Expand Up @@ -2435,13 +2421,12 @@
lodash "^4.17.15"
redent "^3.0.0"

"@testing-library/react@^12.0.0":
version "12.1.0"
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-12.1.0.tgz#3e9a4002b0b8f986a738a2f88fc458b5af319f35"
integrity sha512-Ge3Ht3qXE82Yv9lyPpQ7ZWgzo/HgOcHu569Y4ZGWcZME38iOFiOg87qnu6hTEa8jTJVL7zYovnvD3GE2nsNIoQ==
"@testing-library/react@^16.1.0":
version "16.1.0"
resolved "https://registry.yarnpkg.com/@testing-library/react/-/react-16.1.0.tgz#aa0c61398bac82eaf89776967e97de41ac742d71"
integrity sha512-Q2ToPvg0KsVL0ohND9A3zLJWcOXXcO8IDu3fj11KhNt0UlCWyFyvnCIBkd12tidB2lkiVRG8VFqdhcqhqnAQtg==
dependencies:
"@babel/runtime" "^7.12.5"
"@testing-library/dom" "^8.0.0"

"@testing-library/[email protected]":
version "14.5.2"
Expand All @@ -2458,11 +2443,6 @@
resolved "https://registry.yarnpkg.com/@trysound/sax/-/sax-0.2.0.tgz#cccaab758af56761eb7bf37af6f03f326dd798ad"
integrity sha512-L7z9BgrNEcYyUYtF+HaEfiS5ebkh9jXqbszz7pC0hRBPaatV0XjSD3+eHrpqFemQfgwiFF0QPIarnIihIDn7OA==

"@types/aria-query@^4.2.0":
version "4.2.2"
resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-4.2.2.tgz#ed4e0ad92306a704f9fb132a0cfcf77486dbe2bc"
integrity sha512-HnYpAE1Y6kRyKM/XkEuiRQhTHvkzMBurTHnpFLYLBGPIylZNPs9jJcuOOYWxPLJCSEtmZT0Y8rHDokKN7rRTig==

"@types/aria-query@^5.0.1":
version "5.0.1"
resolved "https://registry.yarnpkg.com/@types/aria-query/-/aria-query-5.0.1.tgz#3286741fb8f1e1580ac28784add4c7a1d49bdfbc"
Expand Down Expand Up @@ -2660,6 +2640,11 @@
dependencies:
"@types/react" "*"

"@types/react-dom@^18.0.0":
version "18.3.5"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.3.5.tgz#45f9f87398c5dcea085b715c58ddcf1faf65f716"
integrity sha512-P4t6saawp+b/dFrUr2cvkVsfvPguwsxtH6dNIYRllMsefqFzkZk5UIjzyDOv5g1dXIPdG4Sp1yCR4Z6RCUsG/Q==

"@types/react-select@^3.0.26":
version "3.1.2"
resolved "https://registry.yarnpkg.com/@types/react-select/-/react-select-3.1.2.tgz#38627df4b49be9b28f800ed72b35d830369a624b"
Expand Down Expand Up @@ -6867,11 +6852,6 @@ lunr@^2.3.9:
resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1"
integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow==

lz-string@^1.4.4:
version "1.4.4"
resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.4.4.tgz#c0d8eaf36059f705796e1e344811cf4c498d3a26"
integrity sha1-wNjq82BZ9wV5bh40SBHPTEmNOiY=

lz-string@^1.5.0:
version "1.5.0"
resolved "https://registry.yarnpkg.com/lz-string/-/lz-string-1.5.0.tgz#c1ab50f77887b712621201ba9fd4e3a6ed099941"
Expand Down

0 comments on commit eb3b11b

Please sign in to comment.