From d514c60feb79e7eb125aaa3456dd6b8b4ef4bf8c Mon Sep 17 00:00:00 2001 From: Nawfal Ahmed <111358247+NawfalAhmed@users.noreply.github.com> Date: Tue, 1 Aug 2023 16:30:38 +0500 Subject: [PATCH] feat: use react-testing-library for detailed unit tests (#316) * feat: use react-testing-library for tests * feat: update tests for Subscriptions * feat: update tests for NotFoundPage * feat: update tests for ManageSubscriptions * feat: update tests for OrdersandSubscriptions --- package-lock.json | 794 +++++++++++++++++- package.json | 3 +- src/components/BasicAlert.jsx | 8 +- src/components/NotFoundPage.test.jsx | 21 +- src/components/SupportLink.test.jsx | 23 + .../__snapshots__/NotFoundPage.test.jsx.snap | 18 - src/order-history/OrderHistoryPage.test.jsx | 47 +- .../OrderHistoryPage.test.jsx.snap | 58 +- .../OrdersAndSubscriptionsPage.test.jsx | 89 +- .../OrdersAndSubscriptionsPage.test.jsx.snap | 474 ----------- .../ManageSubscriptionsPage.test.jsx | 50 +- src/subscriptions/SubscriptionCardsView.jsx | 11 +- src/subscriptions/SubscriptionUpsell.jsx | 1 + src/subscriptions/Subscriptions.jsx | 2 +- src/subscriptions/Subscriptions.test.jsx | 202 +++-- .../ManageSubscriptionsPage.test.jsx.snap | 101 --- .../__snapshots__/Subscriptions.test.jsx.snap | 363 -------- src/testing.jsx | 33 + 18 files changed, 1112 insertions(+), 1186 deletions(-) create mode 100644 src/components/SupportLink.test.jsx delete mode 100644 src/components/__snapshots__/NotFoundPage.test.jsx.snap delete mode 100644 src/orders-and-subscriptions/__snapshots__/OrdersAndSubscriptionsPage.test.jsx.snap delete mode 100644 src/subscriptions/__snapshots__/ManageSubscriptionsPage.test.jsx.snap delete mode 100644 src/subscriptions/__snapshots__/Subscriptions.test.jsx.snap create mode 100644 src/testing.jsx diff --git a/package-lock.json b/package-lock.json index 91d7a28c..35dfa34d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -62,6 +62,8 @@ "@edx/browserslist-config": "^1.2.0", "@edx/frontend-build": "^12.7.0", "@edx/reactifex": "^2.1.0", + "@testing-library/jest-dom": "^5.14.1", + "@testing-library/react": "^12.1.5", "axios-mock-adapter": "1.21.1", "babel-plugin-transform-class-properties": "6.24.1", "babel-plugin-transform-imports": "2.0.0", @@ -70,10 +72,15 @@ "fetch-mock": "9.11.0", "husky": "8.0.1", "react-dev-utils": "^12.0.1", - "react-test-renderer": "^16.14.0", "redux-mock-store": "1.5.4" } }, + "node_modules/@adobe/css-tools": { + "version": "4.2.0", + "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.2.0.tgz", + "integrity": "sha512-E09FiIft46CmH5Qnjb0wsW54/YQd69LsxeKUOWawmws1XWvyFGURnAChH0mlr7YPFR1ofwvUQfcL0J3lMxXqPA==", + "dev": true + }, "node_modules/@ampproject/remapping": { "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", @@ -3454,6 +3461,27 @@ "node": ">= 10.14.2" } }, + "node_modules/@jest/expect-utils": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/expect-utils/-/expect-utils-29.6.1.tgz", + "integrity": "sha512-o319vIf5pEMx0LmzSxxkYYxo4wrRLKHq9dP1yJU7FoPTB0LfAKSz8SWD6D/6U3v/O52t9cF5t+MeJiRsfk7zMw==", + "dev": true, + "dependencies": { + "jest-get-type": "^29.4.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@jest/expect-utils/node_modules/jest-get-type": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.4.3.tgz", + "integrity": "sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/@jest/fake-timers": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/@jest/fake-timers/-/fake-timers-26.6.2.tgz", @@ -3646,6 +3674,18 @@ "node": ">=8" } }, + "node_modules/@jest/schemas": { + "version": "29.6.0", + "resolved": "https://registry.npmjs.org/@jest/schemas/-/schemas-29.6.0.tgz", + "integrity": "sha512-rxLjXyJBTL4LQeJW3aKo0M/+GkCOXsO+8i9Iu7eDb6KwtP65ayoDsitrdPBtujxQ88k4wI2FNYfa6TOGwSn6cQ==", + "dev": true, + "dependencies": { + "@sinclair/typebox": "^0.27.8" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, "node_modules/@jest/source-map": { "version": "26.6.2", "resolved": "https://registry.npmjs.org/@jest/source-map/-/source-map-26.6.2.tgz", @@ -4346,6 +4386,12 @@ "react": ">=16.8.0" } }, + "node_modules/@sinclair/typebox": { + "version": "0.27.8", + "resolved": "https://registry.npmjs.org/@sinclair/typebox/-/typebox-0.27.8.tgz", + "integrity": "sha512-+Fj43pSMwJs4KRrH/938Uf+uAELIgVBmQzg/q1YG10djyfA3TnrU8N8XzqCh/okZdszqBQTZf96idMfE5lnwTA==", + "dev": true + }, "node_modules/@sinonjs/commons": { "version": "1.8.3", "resolved": "https://registry.npmjs.org/@sinonjs/commons/-/commons-1.8.3.tgz", @@ -4621,6 +4667,287 @@ "url": "https://github.com/sponsors/gregberge" } }, + "node_modules/@testing-library/dom": { + "version": "8.20.1", + "resolved": "https://registry.npmjs.org/@testing-library/dom/-/dom-8.20.1.tgz", + "integrity": "sha512-/DiOQ5xBxgdYRC8LNk7U+RWat0S3qRLeIw3ZIkMQ9kkVlRmwD/Eg8k8CqIpD6GW7u20JIUOfMKbxtiLutpjQ4g==", + "dev": true, + "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" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@testing-library/dom/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@testing-library/dom/node_modules/aria-query": { + "version": "5.1.3", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.1.3.tgz", + "integrity": "sha512-R5iJ5lkuHybztUfuOAznmboyjWq8O6sqNqtK7CLOqdydi54VNbORp49mb14KbWgG1QD3JFO9hJdZ+y4KutfdOQ==", + "dev": true, + "dependencies": { + "deep-equal": "^2.0.5" + } + }, + "node_modules/@testing-library/dom/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@testing-library/dom/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@testing-library/dom/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/@testing-library/dom/node_modules/deep-equal": { + "version": "2.2.2", + "resolved": "https://registry.npmjs.org/deep-equal/-/deep-equal-2.2.2.tgz", + "integrity": "sha512-xjVyBf0w5vH0I42jdAZzOKVldmPgSulmiyPRywoyq7HXC9qdgo17kxJE+rdnif5Tz6+pIrpJI8dCpMNLIGkUiA==", + "dev": true, + "dependencies": { + "array-buffer-byte-length": "^1.0.0", + "call-bind": "^1.0.2", + "es-get-iterator": "^1.1.3", + "get-intrinsic": "^1.2.1", + "is-arguments": "^1.1.1", + "is-array-buffer": "^3.0.2", + "is-date-object": "^1.0.5", + "is-regex": "^1.1.4", + "is-shared-array-buffer": "^1.0.2", + "isarray": "^2.0.5", + "object-is": "^1.1.5", + "object-keys": "^1.1.1", + "object.assign": "^4.1.4", + "regexp.prototype.flags": "^1.5.0", + "side-channel": "^1.0.4", + "which-boxed-primitive": "^1.0.2", + "which-collection": "^1.0.1", + "which-typed-array": "^1.1.9" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/@testing-library/dom/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@testing-library/dom/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, + "node_modules/@testing-library/dom/node_modules/pretty-format": { + "version": "27.5.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-27.5.1.tgz", + "integrity": "sha512-Qb1gy5OrP5+zDf2Bvnzdl3jsTf1qXVMazbvCoKhtKqVs4/YK4ozX4gKQJJVyNe+cajNPn0KoC0MC3FUmaHWEmQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1", + "ansi-styles": "^5.0.0", + "react-is": "^17.0.1" + }, + "engines": { + "node": "^10.13.0 || ^12.13.0 || ^14.15.0 || >=15.0.0" + } + }, + "node_modules/@testing-library/dom/node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@testing-library/dom/node_modules/react-is": { + "version": "17.0.2", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", + "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==", + "dev": true + }, + "node_modules/@testing-library/dom/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@testing-library/jest-dom": { + "version": "5.17.0", + "resolved": "https://registry.npmjs.org/@testing-library/jest-dom/-/jest-dom-5.17.0.tgz", + "integrity": "sha512-ynmNeT7asXyH3aSVv4vvX4Rb+0qjOhdNHnO/3vuZNqPmhDpV/+rCSGwQ7bLcmU2cJ4dvoheIO85LQj0IbJHEtg==", + "dev": true, + "dependencies": { + "@adobe/css-tools": "^4.0.1", + "@babel/runtime": "^7.9.2", + "@types/testing-library__jest-dom": "^5.9.1", + "aria-query": "^5.0.0", + "chalk": "^3.0.0", + "css.escape": "^1.5.1", + "dom-accessibility-api": "^0.5.6", + "lodash": "^4.17.15", + "redent": "^3.0.0" + }, + "engines": { + "node": ">=8", + "npm": ">=6", + "yarn": ">=1" + } + }, + "node_modules/@testing-library/jest-dom/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@testing-library/jest-dom/node_modules/aria-query": { + "version": "5.3.0", + "resolved": "https://registry.npmjs.org/aria-query/-/aria-query-5.3.0.tgz", + "integrity": "sha512-b0P0sZPKtyu8HkeRAfCq0IfURZK+SuwMjY1UXGBU27wpAiTwQAIlq56IbIO+ytk/JjS1fMR14ee5WBBfKi5J6A==", + "dev": true, + "dependencies": { + "dequal": "^2.0.3" + } + }, + "node_modules/@testing-library/jest-dom/node_modules/chalk": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-3.0.0.tgz", + "integrity": "sha512-4D3B6Wf41KOYRFdszmDqMCGq5VV/uMAB273JILmO+3jAlh8X4qDtdtgCR3fxtbLEMzSx22QdhnDcJvu2u1fVwg==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@testing-library/jest-dom/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@testing-library/jest-dom/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/@testing-library/jest-dom/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@testing-library/jest-dom/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/@testing-library/react": { + "version": "12.1.5", + "resolved": "https://registry.npmjs.org/@testing-library/react/-/react-12.1.5.tgz", + "integrity": "sha512-OfTXCJUFgjd/digLUuPxa0+/3ZxsQmE7ub9kcbW/wi96Bh3o/p5vrETcBGfP17NWPGqeYYl5LTRpwyGoMC4ysg==", + "dev": true, + "dependencies": { + "@babel/runtime": "^7.12.5", + "@testing-library/dom": "^8.0.0", + "@types/react-dom": "<18.0.0" + }, + "engines": { + "node": ">=12" + }, + "peerDependencies": { + "react": "<18.0.0", + "react-dom": "<18.0.0" + } + }, "node_modules/@tootallnate/once": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-1.1.2.tgz", @@ -4639,6 +4966,12 @@ "node": ">=10.13.0" } }, + "node_modules/@types/aria-query": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/@types/aria-query/-/aria-query-5.0.1.tgz", + "integrity": "sha512-XTIieEY+gvJ39ChLcB4If5zHtPxt3Syj5rgZR+e1ctpmK8NjPf0zFqsz4JpLJT0xla9GFDKjy8Cpu331nrmE1Q==", + "dev": true + }, "node_modules/@types/babel__core": { "version": "7.1.19", "resolved": "https://registry.npmjs.org/@types/babel__core/-/babel__core-7.1.19.tgz", @@ -4853,6 +5186,270 @@ "@types/istanbul-lib-report": "*" } }, + "node_modules/@types/jest": { + "version": "29.5.3", + "resolved": "https://registry.npmjs.org/@types/jest/-/jest-29.5.3.tgz", + "integrity": "sha512-1Nq7YrO/vJE/FYnqYyw0FS8LdrjExSgIiHyKg7xPpn+yi8Q4huZryKnkJatN1ZRH89Kw2v33/8ZMB7DuZeSLlA==", + "dev": true, + "dependencies": { + "expect": "^29.0.0", + "pretty-format": "^29.0.0" + } + }, + "node_modules/@types/jest/node_modules/@jest/types": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/@jest/types/-/types-29.6.1.tgz", + "integrity": "sha512-tPKQNMPuXgvdOn2/Lg9HNfUvjYVGolt04Hp03f5hAk878uwOLikN+JzeLY0HcVgKgFl9Hs3EIqpu3WX27XNhnw==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.0", + "@types/istanbul-lib-coverage": "^2.0.0", + "@types/istanbul-reports": "^3.0.0", + "@types/node": "*", + "@types/yargs": "^17.0.8", + "chalk": "^4.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/@types/yargs": { + "version": "17.0.24", + "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-17.0.24.tgz", + "integrity": "sha512-6i0aC7jV6QzQB8ne1joVZ0eSFIstHsCrobmOtghM11yGlH0j43FKL2UhWdELkyps0zuf7qVTUVCCR+tgSlyLLw==", + "dev": true, + "dependencies": { + "@types/yargs-parser": "*" + } + }, + "node_modules/@types/jest/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@types/jest/node_modules/chalk": { + "version": "4.1.2", + "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.2.tgz", + "integrity": "sha512-oKnbhFyRIXpUuez8iBMmyEa4nbj4IOQyuhc/wy9kY7/WVPcwIO9VA668Pu8RkO7+0G76SLROeyw9CpQ061i4mA==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.1.0", + "supports-color": "^7.1.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/chalk?sponsor=1" + } + }, + "node_modules/@types/jest/node_modules/ci-info": { + "version": "3.8.0", + "resolved": "https://registry.npmjs.org/ci-info/-/ci-info-3.8.0.tgz", + "integrity": "sha512-eXTggHWSooYhq49F2opQhuHWgzucfF2YgODK4e1566GQs5BIfP30B0oenwBJHfWxAs2fyPB1s7Mg949zLf61Yw==", + "dev": true, + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/sibiraj-s" + } + ], + "engines": { + "node": ">=8" + } + }, + "node_modules/@types/jest/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/@types/jest/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true + }, + "node_modules/@types/jest/node_modules/diff-sequences": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/diff-sequences/-/diff-sequences-29.4.3.tgz", + "integrity": "sha512-ofrBgwpPhCD85kMKtE9RYFFq6OC1A89oW2vvgWZNCwxrUpRUILopY7lsYyMDSjc8g6U6aiO0Qubg6r4Wgt5ZnA==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/expect": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/expect/-/expect-29.6.1.tgz", + "integrity": "sha512-XEdDLonERCU1n9uR56/Stx9OqojaLAQtZf9PrCHH9Hl8YXiEIka3H4NXJ3NOIBmQJTg7+j7buh34PMHfJujc8g==", + "dev": true, + "dependencies": { + "@jest/expect-utils": "^29.6.1", + "@types/node": "*", + "jest-get-type": "^29.4.3", + "jest-matcher-utils": "^29.6.1", + "jest-message-util": "^29.6.1", + "jest-util": "^29.6.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/has-flag": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz", + "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@types/jest/node_modules/jest-diff": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-diff/-/jest-diff-29.6.1.tgz", + "integrity": "sha512-FsNCvinvl8oVxpNLttNQX7FAq7vR+gMDGj90tiP7siWw1UdakWUGqrylpsYrpvj908IYckm5Y0Q7azNAozU1Kg==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "diff-sequences": "^29.4.3", + "jest-get-type": "^29.4.3", + "pretty-format": "^29.6.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/jest-get-type": { + "version": "29.4.3", + "resolved": "https://registry.npmjs.org/jest-get-type/-/jest-get-type-29.4.3.tgz", + "integrity": "sha512-J5Xez4nRRMjk8emnTpWrlkyb9pfRQQanDrvWHhsR1+VUfbwxi30eVcZFlcdGInRibU4G5LwHXpI7IRHU0CY+gg==", + "dev": true, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/jest-matcher-utils": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-matcher-utils/-/jest-matcher-utils-29.6.1.tgz", + "integrity": "sha512-SLaztw9d2mfQQKHmJXKM0HCbl2PPVld/t9Xa6P9sgiExijviSp7TnZZpw2Fpt+OI3nwUO/slJbOfzfUMKKC5QA==", + "dev": true, + "dependencies": { + "chalk": "^4.0.0", + "jest-diff": "^29.6.1", + "jest-get-type": "^29.4.3", + "pretty-format": "^29.6.1" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/jest-message-util": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-message-util/-/jest-message-util-29.6.1.tgz", + "integrity": "sha512-KoAW2zAmNSd3Gk88uJ56qXUWbFk787QKmjjJVOjtGFmmGSZgDBrlIL4AfQw1xyMYPNVD7dNInfIbur9B2rd/wQ==", + "dev": true, + "dependencies": { + "@babel/code-frame": "^7.12.13", + "@jest/types": "^29.6.1", + "@types/stack-utils": "^2.0.0", + "chalk": "^4.0.0", + "graceful-fs": "^4.2.9", + "micromatch": "^4.0.4", + "pretty-format": "^29.6.1", + "slash": "^3.0.0", + "stack-utils": "^2.0.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/jest-util": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/jest-util/-/jest-util-29.6.1.tgz", + "integrity": "sha512-NRFCcjc+/uO3ijUVyNOQJluf8PtGCe/W6cix36+M3cTFgiYqFOOW5MgN4JOOcvbUhcKTYVd1CvHz/LWi8d16Mg==", + "dev": true, + "dependencies": { + "@jest/types": "^29.6.1", + "@types/node": "*", + "chalk": "^4.0.0", + "ci-info": "^3.2.0", + "graceful-fs": "^4.2.9", + "picomatch": "^2.2.3" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/pretty-format": { + "version": "29.6.1", + "resolved": "https://registry.npmjs.org/pretty-format/-/pretty-format-29.6.1.tgz", + "integrity": "sha512-7jRj+yXO0W7e4/tSJKoR7HRIHLPPjtNaUGG2xxKQnGvPNRkgWcQ0AZX6P4KBRJN4FcTBWb3sa7DVUJmocYuoog==", + "dev": true, + "dependencies": { + "@jest/schemas": "^29.6.0", + "ansi-styles": "^5.0.0", + "react-is": "^18.0.0" + }, + "engines": { + "node": "^14.15.0 || ^16.10.0 || >=18.0.0" + } + }, + "node_modules/@types/jest/node_modules/pretty-format/node_modules/ansi-styles": { + "version": "5.2.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-5.2.0.tgz", + "integrity": "sha512-Cxwpt2SfTzTtXcfOlzGEee8O+c+MmUgGrNiBcXnuWxuFJHe6a5Hz7qwhwe5OgaSYI0IJvkLqWX1ASG+cJOkEiA==", + "dev": true, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@types/jest/node_modules/react-is": { + "version": "18.2.0", + "resolved": "https://registry.npmjs.org/react-is/-/react-is-18.2.0.tgz", + "integrity": "sha512-xWGDIW6x921xtzPkhiULtthJHoJvBbF3q26fzloPCK0hsvxtPVelvftw3zjbHWSkR2km9Z+4uxbDDK/6Zw9B8w==", + "dev": true + }, + "node_modules/@types/jest/node_modules/slash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/slash/-/slash-3.0.0.tgz", + "integrity": "sha512-g9Q1haeby36OSStwb4ntCGGGaKsaVSjQ68fBxoQcutl5fS1vuY18H3wSt3jFyFtrkx+Kz0V1G85A4MyAdDMi2Q==", + "dev": true, + "engines": { + "node": ">=8" + } + }, + "node_modules/@types/jest/node_modules/supports-color": { + "version": "7.2.0", + "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", + "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==", + "dev": true, + "dependencies": { + "has-flag": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/@types/json-schema": { "version": "7.0.11", "resolved": "https://registry.npmjs.org/@types/json-schema/-/json-schema-7.0.11.tgz", @@ -4932,6 +5529,15 @@ "csstype": "^3.0.2" } }, + "node_modules/@types/react-dom": { + "version": "17.0.20", + "resolved": "https://registry.npmjs.org/@types/react-dom/-/react-dom-17.0.20.tgz", + "integrity": "sha512-4pzIjSxDueZZ90F52mU3aPoogkHIoSIDG+oQ+wQK7Cy2B9S+MvOqY0uEA/qawKz381qrEDkvpwyt8Bm31I8sbA==", + "dev": true, + "dependencies": { + "@types/react": "^17" + } + }, "node_modules/@types/react-redux": { "version": "7.1.24", "resolved": "https://registry.npmjs.org/@types/react-redux/-/react-redux-7.1.24.tgz", @@ -5018,6 +5624,15 @@ "integrity": "sha512-ipixuVrh2OdNmauvtT51o3d8z12p6LtFW9in7U79der/kwejjdNchQC5UMn5u/KxNoM7VHHOs/l8KS8uHxhODQ==", "dev": true }, + "node_modules/@types/testing-library__jest-dom": { + "version": "5.14.9", + "resolved": "https://registry.npmjs.org/@types/testing-library__jest-dom/-/testing-library__jest-dom-5.14.9.tgz", + "integrity": "sha512-FSYhIjFlfOpGSRyVoMBMuS3ws5ehFQODymf3vlI7U1K8c7PHwWwFY7VREfmsuzHSOnoKs/9/Y983ayOs7eRzqw==", + "dev": true, + "dependencies": { + "@types/jest": "*" + } + }, "node_modules/@types/uglify-js": { "version": "3.17.1", "resolved": "https://registry.npmjs.org/@types/uglify-js/-/uglify-js-3.17.1.tgz", @@ -7753,6 +8368,12 @@ "url": "https://github.com/sponsors/fb55" } }, + "node_modules/css.escape": { + "version": "1.5.1", + "resolved": "https://registry.npmjs.org/css.escape/-/css.escape-1.5.1.tgz", + "integrity": "sha512-YUifsXXuknHlUsmlgyY0PKzgPOr7/FjCePfHNt0jxm83wHZi44VDMQ7/fGNkjY3/jV1MC+1CmZbaHzugyeRtpg==", + "dev": true + }, "node_modules/cssesc": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/cssesc/-/cssesc-3.0.0.tgz", @@ -8142,9 +8763,9 @@ } }, "node_modules/define-properties": { - "version": "1.1.4", - "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.1.4.tgz", - "integrity": "sha512-uckOqKcfaVvtBdsVkdPv3XjveQJsNQqmhXgRi8uhvWWuPYZCNlzT8qAyblUgNoXdHdjMTzAqeGjAoli8f+bzPA==", + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/define-properties/-/define-properties-1.2.0.tgz", + "integrity": "sha512-xvqAVKGfT1+UAvPwKTVw/njhdQ8ZhXK4lI0bCIuCMrp2up9nPnaDftrLtmpTazqd1o+UY4zgzU+avtMbDP+ldA==", "dev": true, "dependencies": { "has-property-descriptors": "^1.0.0", @@ -8353,6 +8974,12 @@ "node": ">=6.0.0" } }, + "node_modules/dom-accessibility-api": { + "version": "0.5.16", + "resolved": "https://registry.npmjs.org/dom-accessibility-api/-/dom-accessibility-api-0.5.16.tgz", + "integrity": "sha512-X7BJ2yElsnOJ30pZF4uIIDfBEVgF4XEBxL9Bxhy6dnrm5hkzqmsWHGTiHqRiITNhMyFLyAiWndIJP7Z1NTteDg==", + "dev": true + }, "node_modules/dom-converter": { "version": "0.2.0", "resolved": "https://registry.npmjs.org/dom-converter/-/dom-converter-0.2.0.tgz", @@ -8810,6 +9437,32 @@ "integrity": "sha512-wd6JXUmyHmt8T5a2xreUwKcGPq6f1f+WwIJkijUqiGcJz1qqnZgP6XIK+QyIWU5lT7imeNxUll48bziG+TSYcA==", "dev": true }, + "node_modules/es-get-iterator": { + "version": "1.1.3", + "resolved": "https://registry.npmjs.org/es-get-iterator/-/es-get-iterator-1.1.3.tgz", + "integrity": "sha512-sPZmqHBe6JIiTfN5q2pEi//TwxmAFHwj/XEuYjTuse78i8KxaqMTTzxPoFKuzRpDpTJ+0NAbpfenkmH2rePtuw==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.3", + "has-symbols": "^1.0.3", + "is-arguments": "^1.1.1", + "is-map": "^2.0.2", + "is-set": "^2.0.2", + "is-string": "^1.0.7", + "isarray": "^2.0.5", + "stop-iteration-iterator": "^1.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/es-get-iterator/node_modules/isarray": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/isarray/-/isarray-2.0.5.tgz", + "integrity": "sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw==", + "dev": true + }, "node_modules/es-module-lexer": { "version": "0.9.3", "resolved": "https://registry.npmjs.org/es-module-lexer/-/es-module-lexer-0.9.3.tgz", @@ -10895,9 +11548,9 @@ } }, "node_modules/functions-have-names": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.2.tgz", - "integrity": "sha512-bLgc3asbWdwPbx2mNk2S49kmJCuQeu0nfmaOgbs8WIyzzkw3r4htszdIi9Q9EMezDPTYuJx2wvjZ/EwgAthpnA==", + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/functions-have-names/-/functions-have-names-1.2.3.tgz", + "integrity": "sha512-xckBUXyTIqT97tq2x2AMb+g163b5JFysYk0x4qxNFwbfQkmNZoiRHb6sPzI9/QV33WeuvVYBUIiD4NzNIyqaRQ==", "dev": true, "funding": { "url": "https://github.com/sponsors/ljharb" @@ -10921,13 +11574,14 @@ } }, "node_modules/get-intrinsic": { - "version": "1.2.0", - "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.0.tgz", - "integrity": "sha512-L049y6nFOuom5wGyRc3/gdTLO94dySVKRACj1RmJZBQXlbTMhtNIgkWkUHq+jYmZvKf14EW1EoJnnjbmoHij0Q==", + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.2.1.tgz", + "integrity": "sha512-2DcsyfABl+gVHEfCOaTrWgyt+tb6MSEGmKq+kI5HwLbIYgjgmMcV8KQ41uaKz1xxUcn9tJtgFbQUEVcEbd0FYw==", "dev": true, "dependencies": { "function-bind": "^1.1.1", "has": "^1.0.3", + "has-proto": "^1.0.1", "has-symbols": "^1.0.3" }, "funding": { @@ -12299,6 +12953,15 @@ "node": ">=0.10.0" } }, + "node_modules/is-map": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-map/-/is-map-2.0.2.tgz", + "integrity": "sha512-cOZFQQozTha1f4MxLFzlgKYPTyj26picdZTx82hbc/Xf4K/tZOOXSCkMvU4pKioRXGDLJRn0GM7Upe7kR721yg==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-negative-zero": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/is-negative-zero/-/is-negative-zero-2.0.2.tgz", @@ -12423,6 +13086,15 @@ "node": ">=6" } }, + "node_modules/is-set": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-set/-/is-set-2.0.2.tgz", + "integrity": "sha512-+2cnTEZeY5z/iXGbLhPrOAaK/Mau5k5eXq9j14CpRTftq0pAJu2MwVRSZhyZWBzx3o6X795Lz6Bpb6R0GKf37g==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-shared-array-buffer": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-shared-array-buffer/-/is-shared-array-buffer-1.0.2.tgz", @@ -12517,6 +13189,15 @@ "node": ">=0.10.0" } }, + "node_modules/is-weakmap": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/is-weakmap/-/is-weakmap-2.0.1.tgz", + "integrity": "sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA==", + "dev": true, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-weakref": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-weakref/-/is-weakref-1.0.2.tgz", @@ -12529,6 +13210,19 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/is-weakset": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/is-weakset/-/is-weakset-2.0.2.tgz", + "integrity": "sha512-t2yVvttHkQktwnNNmBQ98AhENLdPUTDTE21uPqAQ0ARwQfGeQKRVS0NNurH7bTf7RrvcVn1OOge45CnBeHCSmg==", + "dev": true, + "dependencies": { + "call-bind": "^1.0.2", + "get-intrinsic": "^1.1.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/is-windows": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/is-windows/-/is-windows-1.0.2.tgz", @@ -15229,6 +15923,15 @@ "yallist": "^3.0.2" } }, + "node_modules/lz-string": { + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/lz-string/-/lz-string-1.5.0.tgz", + "integrity": "sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==", + "dev": true, + "bin": { + "lz-string": "bin/bin.js" + } + }, "node_modules/mailto-link": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/mailto-link/-/mailto-link-2.0.0.tgz", @@ -15425,6 +16128,15 @@ "url": "https://github.com/sponsors/sindresorhus" } }, + "node_modules/min-indent": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/min-indent/-/min-indent-1.0.1.tgz", + "integrity": "sha512-I9jwMn07Sy/IwOj3zVkVik2JTvgpaykDZEigL6Rx6N9LbMywwUSMtxET+7lVoDLLd3O3IXwJwvuuns8UB/HeAg==", + "dev": true, + "engines": { + "node": ">=4" + } + }, "node_modules/mini-create-react-context": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/mini-create-react-context/-/mini-create-react-context-0.4.1.tgz", @@ -20831,6 +21543,19 @@ "node": "*" } }, + "node_modules/redent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/redent/-/redent-3.0.0.tgz", + "integrity": "sha512-6tDA8g98We0zd0GvVeMT9arEOnTw9qM03L9cJXaCjrip1OO764RDBLBfrB4cwzNGDj5OA5ioymC9GkizgWJDUg==", + "dev": true, + "dependencies": { + "indent-string": "^4.0.0", + "strip-indent": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/reduce-reducers": { "version": "0.4.3", "resolved": "https://registry.npmjs.org/reduce-reducers/-/reduce-reducers-0.4.3.tgz", @@ -20959,14 +21684,14 @@ "dev": true }, "node_modules/regexp.prototype.flags": { - "version": "1.4.3", - "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.4.3.tgz", - "integrity": "sha512-fjggEOO3slI6Wvgjwflkc4NFRCTZAu5CnNfBd5qOMYhWdn67nJBBu34/TkD++eeFmd8C9r9jfXJ27+nSiRkSUA==", + "version": "1.5.0", + "resolved": "https://registry.npmjs.org/regexp.prototype.flags/-/regexp.prototype.flags-1.5.0.tgz", + "integrity": "sha512-0SutC3pNudRKgquxGoRGIz946MZVHqbNfPjBdxeOhBrdgDKlRoXmYLQN9xRbrR09ZXWeGAdPuif7egofn6v5LA==", "dev": true, "dependencies": { "call-bind": "^1.0.2", - "define-properties": "^1.1.3", - "functions-have-names": "^1.2.2" + "define-properties": "^1.2.0", + "functions-have-names": "^1.2.3" }, "engines": { "node": ">= 0.4" @@ -22582,6 +23307,18 @@ "node": ">= 0.8" } }, + "node_modules/stop-iteration-iterator": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/stop-iteration-iterator/-/stop-iteration-iterator-1.0.0.tgz", + "integrity": "sha512-iCGQj+0l0HOdZ2AEeBADlsRC+vsnDsZsbdSiH1yNSjcfKM7fdpCMfqAL/dwF5BLiw/XhRft/Wax6zQbhq2BcjQ==", + "dev": true, + "dependencies": { + "internal-slot": "^1.0.4" + }, + "engines": { + "node": ">= 0.4" + } + }, "node_modules/string_decoder": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", @@ -22742,6 +23479,18 @@ "node": ">=6" } }, + "node_modules/strip-indent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/strip-indent/-/strip-indent-3.0.0.tgz", + "integrity": "sha512-laJTa3Jb+VQpaC6DseHhF7dXVqHTfJPCRDaEbid/drOhgitgYku/letMUqOXFoWV0zIIUbjpdH2t+tYj4bQMRQ==", + "dev": true, + "dependencies": { + "min-indent": "^1.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-json-comments": { "version": "3.1.1", "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.1.1.tgz", @@ -24664,6 +25413,21 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/which-collection": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/which-collection/-/which-collection-1.0.1.tgz", + "integrity": "sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A==", + "dev": true, + "dependencies": { + "is-map": "^2.0.1", + "is-set": "^2.0.1", + "is-weakmap": "^2.0.1", + "is-weakset": "^2.0.1" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/which-module": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/which-module/-/which-module-2.0.0.tgz", diff --git a/package.json b/package.json index cffa1f24..7e4ccd1d 100644 --- a/package.json +++ b/package.json @@ -79,6 +79,8 @@ "@edx/browserslist-config": "^1.2.0", "@edx/frontend-build": "^12.7.0", "@edx/reactifex": "^2.1.0", + "@testing-library/jest-dom": "^5.14.1", + "@testing-library/react": "^12.1.5", "axios-mock-adapter": "1.21.1", "babel-plugin-transform-class-properties": "6.24.1", "babel-plugin-transform-imports": "2.0.0", @@ -87,7 +89,6 @@ "fetch-mock": "9.11.0", "husky": "8.0.1", "react-dev-utils": "^12.0.1", - "react-test-renderer": "^16.14.0", "redux-mock-store": "1.5.4" } } diff --git a/src/components/BasicAlert.jsx b/src/components/BasicAlert.jsx index 53326f5c..62eb7333 100644 --- a/src/components/BasicAlert.jsx +++ b/src/components/BasicAlert.jsx @@ -30,6 +30,7 @@ const BasicAlert = ({ isModal, isVisible, onClose }) => { return isModal ? ( {

{body}

) : ( - + {title}

{body}

diff --git a/src/components/NotFoundPage.test.jsx b/src/components/NotFoundPage.test.jsx index c8c39eb0..f5ba4721 100644 --- a/src/components/NotFoundPage.test.jsx +++ b/src/components/NotFoundPage.test.jsx @@ -1,20 +1,15 @@ import React from 'react'; -import renderer from 'react-test-renderer'; -import { IntlProvider } from '@edx/frontend-platform/i18n'; +import { render } from '../testing'; import NotFoundPage from './NotFoundPage'; describe('', () => { - describe('Renders NotFoundPage', () => { - it('renders not found page', () => { - const tree = renderer - .create(( - - - - )) - .toJSON(); - expect(tree).toMatchSnapshot(); - }); + it('Renders not found message', () => { + const { getByText } = render(); + expect( + getByText( + "The page you're looking for is unavailable or there's an error in the URL. Please check the URL and try again.", + ), + ).toBeInTheDocument(); }); }); diff --git a/src/components/SupportLink.test.jsx b/src/components/SupportLink.test.jsx new file mode 100644 index 00000000..37dc65a0 --- /dev/null +++ b/src/components/SupportLink.test.jsx @@ -0,0 +1,23 @@ +import React from 'react'; +import { render } from '../testing'; + +import SupportLink from './SupportLink'; + +jest.mock('@edx/frontend-platform', () => ({ + getConfig: () => ({ + SUPPORT_URL: 'https://example.com/support', + }), +})); + +describe('', () => { + it('Renders support link', () => { + const { getByText } = render(); + + const contactSupportLink = getByText('contact support'); + expect(contactSupportLink).toBeInTheDocument(); + expect(contactSupportLink).toHaveAttribute( + 'href', + 'https://example.com/support/hc/requests/new', + ); + }); +}); diff --git a/src/components/__snapshots__/NotFoundPage.test.jsx.snap b/src/components/__snapshots__/NotFoundPage.test.jsx.snap deleted file mode 100644 index 0fb90fad..00000000 --- a/src/components/__snapshots__/NotFoundPage.test.jsx.snap +++ /dev/null @@ -1,18 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` Renders NotFoundPage renders not found page 1`] = ` -
-

- The page you're looking for is unavailable or there's an error in the URL. Please check the URL and try again. -

-
-`; diff --git a/src/order-history/OrderHistoryPage.test.jsx b/src/order-history/OrderHistoryPage.test.jsx index c56a643a..a0a80e22 100644 --- a/src/order-history/OrderHistoryPage.test.jsx +++ b/src/order-history/OrderHistoryPage.test.jsx @@ -1,13 +1,9 @@ /* eslint-disable global-require */ import React from 'react'; -import renderer from 'react-test-renderer'; -import { Provider } from 'react-redux'; -import { IntlProvider } from '@edx/frontend-platform/i18n'; -import configureMockStore from 'redux-mock-store'; +import { render } from '../testing'; import ConnectedOrderHistoryPage from './OrderHistoryPage'; -const mockStore = configureMockStore(); const storeMocks = require('../store/__mocks__/mockStore'); const requiredOrderHistoryPageProps = { @@ -24,19 +20,18 @@ global.matchMedia = (media) => ({ matches: true, }); +const matchSnapshot = (store) => { + const { container } = render( + , + store, + ); + expect(container.querySelector('section')).toMatchSnapshot(); +}; + describe('', () => { describe('Renders correctly in various states', () => { it('renders orders table with pagination', () => { - const tree = renderer - .create( - - - - - , - ) - .toJSON(); - expect(tree).toMatchSnapshot(); + matchSnapshot(storeMocks); }); it('renders empty orders', () => { @@ -51,16 +46,7 @@ describe('', () => { }, }; - const tree = renderer - .create( - - - - - , - ) - .toJSON(); - expect(tree).toMatchSnapshot(); + matchSnapshot(storeMockWithoutOrders); }); it('renders loading state', () => { @@ -77,16 +63,7 @@ describe('', () => { }, }; - const tree = renderer - .create( - - - - - , - ) - .toJSON(); - expect(tree).toMatchSnapshot(); + matchSnapshot(storeMockWithLoading); }); }); }); diff --git a/src/order-history/__snapshots__/OrderHistoryPage.test.jsx.snap b/src/order-history/__snapshots__/OrderHistoryPage.test.jsx.snap index 69b51133..0d5c78b9 100644 --- a/src/order-history/__snapshots__/OrderHistoryPage.test.jsx.snap +++ b/src/order-history/__snapshots__/OrderHistoryPage.test.jsx.snap @@ -2,7 +2,7 @@ exports[` Renders correctly in various states renders empty orders 1`] = `

Order History @@ -17,7 +17,7 @@ exports[` Renders correctly in various states renders empty exports[` Renders correctly in various states renders loading state 1`] = `

Order History @@ -25,19 +25,15 @@ exports[` Renders correctly in various states renders loadin
Loading orders... @@ -50,7 +46,7 @@ exports[` Renders correctly in various states renders loadin exports[` Renders correctly in various states renders orders table with pagination 1`] = `

Order History @@ -58,41 +54,39 @@ exports[` Renders correctly in various states renders orders
- -

-
-

- Order History -

-
- -
-
-
-`; diff --git a/src/subscriptions/ManageSubscriptionsPage.test.jsx b/src/subscriptions/ManageSubscriptionsPage.test.jsx index 4a4f7c29..f00f7ec4 100644 --- a/src/subscriptions/ManageSubscriptionsPage.test.jsx +++ b/src/subscriptions/ManageSubscriptionsPage.test.jsx @@ -1,15 +1,13 @@ /* eslint-disable global-require */ import React from 'react'; -import renderer, { act } from 'react-test-renderer'; -import { Provider } from 'react-redux'; -import { IntlProvider } from '@edx/frontend-platform/i18n'; -import configureMockStore from 'redux-mock-store'; +import { act, render, screen } from '../testing'; import ManageSubscriptionsPage from './ManageSubscriptionsPage'; -const mockStore = configureMockStore(); const storeMocks = require('../store/__mocks__/mockEmptyStore'); +const { getByText, getAllByText } = screen; + describe('', () => { describe('Renders correctly in various states', () => { it('navigates when url is fetched correctly', () => { @@ -31,33 +29,20 @@ describe('', () => { }; jest.useFakeTimers(); - const tree = renderer - .create( - - - - - , - ) - .toJSON(); + + render(, storeMocksWithURL); + act(() => { jest.runAllTimers(); }); - expect(tree).toMatchSnapshot(); expect(mockHrefSetter).toHaveBeenCalledWith('http://edx.org'); + expect(getByText('Loading manage subscriptions...')).toBeInTheDocument(); }); it('renders loading when url is being fetched', () => { - const tree = renderer - .create( - - - - - , - ) - .toJSON(); - expect(tree).toMatchSnapshot(); + render(, storeMocks); + + expect(getByText('Loading manage subscriptions...')).toBeInTheDocument(); }); it('renders error ui when fetching url fails', () => { @@ -69,16 +54,11 @@ describe('', () => { }, }; - const tree = renderer - .create( - - - - - , - ) - .toJSON(); - expect(tree).toMatchSnapshot(); + render(, storeMocksWithError); + + expect(getByText('Something went wrong')).toBeInTheDocument(); + expect(getByText('contact support')).toBeInTheDocument(); + expect(getAllByText('Orders and subscriptions')).toHaveLength(2); }); }); }); diff --git a/src/subscriptions/SubscriptionCardsView.jsx b/src/subscriptions/SubscriptionCardsView.jsx index efc25636..94664e12 100644 --- a/src/subscriptions/SubscriptionCardsView.jsx +++ b/src/subscriptions/SubscriptionCardsView.jsx @@ -35,7 +35,11 @@ const SubscriptionCardsView = ({ subscriptions }) => { const message = STATUS_MESSAGE_ID_MAP[status]; return ( - +

{title}

@@ -50,7 +54,10 @@ const SubscriptionCardsView = ({ subscriptions }) => { }; return ( -
+
{subscriptions.map(renderItem)}
); diff --git a/src/subscriptions/SubscriptionUpsell.jsx b/src/subscriptions/SubscriptionUpsell.jsx index 488ebb24..667342fd 100644 --- a/src/subscriptions/SubscriptionUpsell.jsx +++ b/src/subscriptions/SubscriptionUpsell.jsx @@ -8,6 +8,7 @@ import { Alert, Badge, Button } from '@edx/paragon'; const SubscriptionUpsell = () => ( { const renderSubscriptions = () => ( <>
- + {formatMessage(messages[subtitle], { activeCount, buttonLabel: {buttonLabel}, diff --git a/src/subscriptions/Subscriptions.test.jsx b/src/subscriptions/Subscriptions.test.jsx index 77b48b9b..7ee5afe6 100644 --- a/src/subscriptions/Subscriptions.test.jsx +++ b/src/subscriptions/Subscriptions.test.jsx @@ -1,70 +1,164 @@ /* eslint-disable global-require */ import React from 'react'; -import renderer from 'react-test-renderer'; -import { Provider } from 'react-redux'; -import { IntlProvider } from '@edx/frontend-platform/i18n'; -import configureMockStore from 'redux-mock-store'; +import { render, screen } from '../testing'; import Subscriptions from './Subscriptions'; -const mockStore = configureMockStore(); const storeMocks = require('../store/__mocks__/mockStore'); +jest.mock('@edx/frontend-platform', () => ({ + getConfig: () => ({ + LMS_BASE_URL: 'https://example.com', + SUBSCRIPTIONS_MINIMUM_PRICE: '$100', + SUBSCRIPTIONS_TRIAL_LENGTH: '7', + MARKETING_SITE_BASE_URL: 'https://example.marketing.com', + SUBSCRIPTIONS_MARKETING_URL: '/subscriptions', + }), +})); + +const { + getByText, + getByTestId, + getAllByText, + getAllByTestId, + queryByText, + queryByTestId, +} = screen; + describe('', () => { - describe('Renders correctly in various states', () => { - it('renders with subscriptions', () => { - const tree = renderer - .create( - - - - - , - ) - .toJSON(); - expect(tree).toMatchSnapshot(); + describe('Renders correctly when user has subscriptions', () => { + const { + subscriptions: { subscriptions }, + } = storeMocks; + + beforeEach(() => { + render(, storeMocks); }); - it('renders with no subscriptions', () => { - const storeMockWithoutSubscriptions = { - ...storeMocks, - subscriptions: { - ...storeMocks.subscriptions, - subscriptions: [], - }, - }; - const tree = renderer - .create( - - - - - , - ) - .toJSON(); - expect(tree).toMatchSnapshot(); + it('Renders appropriate subscription heading', () => { + expect(getByText('Subscriptions')).toBeInTheDocument(); + expect(getByTestId('subscription-subtitle').textContent).toMatch( + /You have 2 active subscriptions\. To view your receipts, change your payment method or cancel your subscription, click.*Manage my subscriptions/, + ); + // Assert the button is rendered + expect(getAllByText('Manage my subscriptions')).toHaveLength(2); }); - it('renders with no active subscriptions', () => { - const storeMockWithoutActiveSubscriptions = { - ...storeMocks, - subscriptions: { - ...storeMocks.subscriptions, - subscriptions: storeMocks.subscriptions.subscriptions.filter( - ({ status }) => status === 'inactive', - ), + it('Renders subscription cards', () => { + const sectionSubscriptionCards = getByTestId( + 'section-subscription-cards', + ); + expect(sectionSubscriptionCards).toBeInTheDocument(); + + // Assert the correct number of subscription cards are rendered + const subscriptionCards = getAllByTestId('subscription-card'); + expect(subscriptionCards).toHaveLength(subscriptions.length); + + // Assert the correct text is rendered for each subscription card + subscriptions.forEach(( + { + uuid, + title, + organizations, + status, }, - }; - const tree = renderer - .create( - - - - - , - ) - .toJSON(); - expect(tree).toMatchSnapshot(); + index, + ) => { + const card = subscriptionCards[index]; + + expect(card).toHaveTextContent(title); + expect(card).toHaveTextContent(new RegExp(status, 'i')); + expect(card).toHaveTextContent(organizations.join(', ')); + + // Assert the correct link is rendered for each subscription card + const expectedUrl = `https://example.com/dashboard/programs/${uuid}`; + expect(card).toHaveAttribute('href', expectedUrl); + }); + }); + + it('Does not render subscription upsell', () => { + expect(queryByTestId('section-subscription-upsell')).toBeNull(); + }); + }); + + describe('Renders correctly when user does not have subscriptions', () => { + const storeMockWithoutSubscriptions = { + ...storeMocks, + subscriptions: { + ...storeMocks.subscriptions, + subscriptions: [], + }, + }; + beforeEach(() => { + render(, storeMockWithoutSubscriptions); + }); + + it('Renders appropriate subscription heading', () => { + expect(getByText('Subscriptions')).toBeInTheDocument(); + expect( + getByText('You do not have any active or previous subscriptions.'), + ).toBeInTheDocument(); + // Assert the button is not rendered + expect(queryByText('Manage my subscriptions')).toBeNull(); + }); + + it('Renders subscription upsell', () => { + const sectionSubscriptionUpsell = getByTestId( + 'section-subscription-upsell', + ); + expect(sectionSubscriptionUpsell).toBeInTheDocument(); + + // Assert the correct text is rendered for the subscription upsell + expect(sectionSubscriptionUpsell).toHaveTextContent('New'); + expect(sectionSubscriptionUpsell).toHaveTextContent( + 'Monthly program subscriptions', + ); + expect(sectionSubscriptionUpsell).toHaveTextContent( + 'Now available for many popular programs, affordable monthly subscription pricing can help you manage your budget more effectively. Subscriptions start at $100/month USD per program, after a 7-day full access free trial. Cancel at any time.', + ); + + const upsellButton = sectionSubscriptionUpsell.querySelector('a'); + expect(upsellButton).toHaveTextContent('Explore subscription options'); + expect(upsellButton).toHaveAttribute( + 'href', + 'https://example.marketing.com/subscriptions', + ); + }); + + it('Does not render subscription cards', () => { + expect(queryByTestId('section-subscription-cards')).toBeNull(); + }); + }); + + describe('Renders correctly when user does not have active subscriptions', () => { + const storeMockWithoutActiveSubscriptions = { + ...storeMocks, + subscriptions: { + ...storeMocks.subscriptions, + subscriptions: storeMocks.subscriptions.subscriptions.filter( + ({ status }) => status === 'inactive', + ), + }, + }; + beforeEach(() => { + render(, storeMockWithoutActiveSubscriptions); + }); + + it('Renders appropriate subscription heading', () => { + expect(getByText('Subscriptions')).toBeInTheDocument(); + expect(getByTestId('subscription-subtitle').textContent).toMatch( + /You do not have an active subscription\. To view your past receipts, click.*Manage my subscriptions/, + ); + // Assert the button is rendered + expect(getAllByText('Manage my subscriptions')).toHaveLength(2); + }); + + it('Render subscription cards', () => { + expect(getByTestId('section-subscription-cards')).toBeInTheDocument(); + }); + + it('Does not render subscription upsell', () => { + expect(queryByTestId('section-subscription-upsell')).toBeNull(); }); }); }); diff --git a/src/subscriptions/__snapshots__/ManageSubscriptionsPage.test.jsx.snap b/src/subscriptions/__snapshots__/ManageSubscriptionsPage.test.jsx.snap deleted file mode 100644 index 64fe955f..00000000 --- a/src/subscriptions/__snapshots__/ManageSubscriptionsPage.test.jsx.snap +++ /dev/null @@ -1,101 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` Renders correctly in various states navigates when url is fetched correctly 1`] = ` -
-
-
- - Loading manage subscriptions... - -
-
-
-`; - -exports[` Renders correctly in various states renders error ui when fetching url fails 1`] = ` -
-
-

- Something went wrong -

-

- The page you’re looking for is unavailable or there was an error. Visit the - - Orders and subscriptions - - page to manage your subscription. -

-

- If this problem persists, - - contact support - - . -

- - Orders and subscriptions - -
-
-`; - -exports[` Renders correctly in various states renders loading when url is being fetched 1`] = ` -
-
-
- - Loading manage subscriptions... - -
-
-
-`; diff --git a/src/subscriptions/__snapshots__/Subscriptions.test.jsx.snap b/src/subscriptions/__snapshots__/Subscriptions.test.jsx.snap deleted file mode 100644 index 8bfdcb6b..00000000 --- a/src/subscriptions/__snapshots__/Subscriptions.test.jsx.snap +++ /dev/null @@ -1,363 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[` Renders correctly in various states renders with no active subscriptions 1`] = ` -
-

- Subscriptions -

-
- - You do not have an active subscription. To view your past receipts, click - - Manage my subscriptions - - . - - -
- -
-`; - -exports[` Renders correctly in various states renders with no subscriptions 1`] = ` -
-

- Subscriptions -

- - You do not have any active or previous subscriptions. - -
-
-
-

- - New - - Monthly program subscriptions - — - more flexible, more affordable -

-

- Now available for many popular programs, affordable monthly subscription pricing can help you manage your budget more effectively. Subscriptions start at $39/month USD per program, after a 7-day full access free trial. Cancel at any time. -

-
- -
-
-
-`; - -exports[` Renders correctly in various states renders with subscriptions 1`] = ` -
-

- Subscriptions -

-
- - You have 2 active subscriptions. To view your receipts, change your payment method or cancel your subscription, click - - Manage my subscriptions - - . - - -
- -
-`; diff --git a/src/testing.jsx b/src/testing.jsx new file mode 100644 index 00000000..13927dbe --- /dev/null +++ b/src/testing.jsx @@ -0,0 +1,33 @@ +/* eslint-disable import/no-extraneous-dependencies */ +import React from 'react'; +import { Provider } from 'react-redux'; +import configureMockStore from 'redux-mock-store'; +import { IntlProvider } from '@edx/frontend-platform/i18n'; + +import { render } from '@testing-library/react'; +import '@testing-library/jest-dom'; + +const mockStore = configureMockStore(); + +jest.mock('@edx/frontend-platform/analytics', () => ({ + sendTrackEvent: jest.fn(), + sendPageEvent: jest.fn(), +})); + +const renderWithProviders = (component, store = null) => render( + + {store ? ( + + {component} + + ) : ( + component + )} + , +); + +// re-export everything +export * from '@testing-library/react'; + +// override render method +export { renderWithProviders as render };