diff --git a/jest.config.js b/jest.config.js
index 215fb8a48..39fc0af80 100644
--- a/jest.config.js
+++ b/jest.config.js
@@ -2,5 +2,9 @@
module.exports = {
preset: "ts-jest",
testEnvironment: "jsdom",
+ testEnvironmentOptions: {
+ customExportConditions: [""],
+ },
+ setupFiles: ["./jest.polyfills.js"],
setupFilesAfterEnv: ["./tests/jest/jest-setup.ts"],
};
diff --git a/jest.polyfills.js b/jest.polyfills.js
new file mode 100644
index 000000000..d12ccda3c
--- /dev/null
+++ b/jest.polyfills.js
@@ -0,0 +1,20 @@
+// jest.polyfills.js
+
+const globalThis = window;
+
+// eslint-disable-next-line @typescript-eslint/no-var-requires
+const { ReadableStream, TextDecoder, TextEncoder } = require("node:util");
+Object.defineProperties(globalThis, {
+ ReadableStream: { value: ReadableStream },
+ TextDecoder: { value: TextDecoder },
+ TextEncoder: { value: TextEncoder },
+});
+
+// eslint-disable-next-line @typescript-eslint/no-var-requires
+const { fetch, Request, Response, Headers } = require("fetch-ponyfill")();
+Object.defineProperties(globalThis, {
+ fetch: { value: fetch, writable: true },
+ Headers: { value: Headers },
+ Request: { value: Request },
+ Response: { value: Response, writable: true },
+});
diff --git a/package-lock.json b/package-lock.json
index fe681e0d7..306f456d6 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -72,6 +72,7 @@
"eslint-plugin-react-hooks": "^4.0.0",
"fetch-mock": "^7.3.1",
"fetch-mock-jest": "^1.5.1",
+ "fetch-ponyfill": "^7.1.0",
"file-loader": "^6.2.0",
"follow-redirects": "^1.15.6",
"husky": "^4.3.0",
@@ -82,7 +83,7 @@
"lint-staged": "^10.4.0",
"mini-css-extract-plugin": "1.6.0",
"mocha": "^10.2.0",
- "msw": "^1.2.1",
+ "msw": "^2.3.0",
"nightwatch": "^3.2.0",
"prettier": "2.1.2",
"react-axe": "^3.3.0",
@@ -767,6 +768,24 @@
"integrity": "sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw==",
"dev": true
},
+ "node_modules/@bundled-es-modules/cookie": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/@bundled-es-modules/cookie/-/cookie-2.0.0.tgz",
+ "integrity": "sha512-Or6YHg/kamKHpxULAdSqhGqnWFneIXu1NKvvfBBzKGwpVsYuFIQ5aBPHDnnoR3ghW1nvSkALd+EF9iMtY7Vjxw==",
+ "dev": true,
+ "dependencies": {
+ "cookie": "^0.5.0"
+ }
+ },
+ "node_modules/@bundled-es-modules/statuses": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/@bundled-es-modules/statuses/-/statuses-1.0.1.tgz",
+ "integrity": "sha512-yn7BklA5acgcBr+7w064fGV+SGIFySjCKpqjcWgBAIfrAkY+4GQTJJHQMeT3V/sgz23VTEVV8TtOmkvJAhFVfg==",
+ "dev": true,
+ "dependencies": {
+ "statuses": "^2.0.1"
+ }
+ },
"node_modules/@colors/colors": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/@colors/colors/-/colors-1.5.0.tgz",
@@ -895,6 +914,112 @@
"react": "*"
}
},
+ "node_modules/@inquirer/confirm": {
+ "version": "3.1.8",
+ "resolved": "https://registry.npmjs.org/@inquirer/confirm/-/confirm-3.1.8.tgz",
+ "integrity": "sha512-f3INZ+ca4dQdn+MQiq1yP/mOIR/Oc8BLRYuDh6ciToWd6z4W8yArfzjBCMQ0BPY8PcJKwZxGIt8Z6yNT32eSTw==",
+ "dev": true,
+ "dependencies": {
+ "@inquirer/core": "^8.2.1",
+ "@inquirer/type": "^1.3.2"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@inquirer/core": {
+ "version": "8.2.1",
+ "resolved": "https://registry.npmjs.org/@inquirer/core/-/core-8.2.1.tgz",
+ "integrity": "sha512-TIcuQMn2qrtyYe0j136UpHeYpk7AcR/trKeT/7YY0vRgcS9YSfJuQ2+PudPhSofLLsHNnRYAHScQCcVZrJkMqA==",
+ "dev": true,
+ "dependencies": {
+ "@inquirer/figures": "^1.0.2",
+ "@inquirer/type": "^1.3.2",
+ "@types/mute-stream": "^0.0.4",
+ "@types/node": "^20.12.12",
+ "@types/wrap-ansi": "^3.0.0",
+ "ansi-escapes": "^4.3.2",
+ "chalk": "^4.1.2",
+ "cli-spinners": "^2.9.2",
+ "cli-width": "^4.1.0",
+ "mute-stream": "^1.0.0",
+ "signal-exit": "^4.1.0",
+ "strip-ansi": "^6.0.1",
+ "wrap-ansi": "^6.2.0"
+ },
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@inquirer/core/node_modules/@types/node": {
+ "version": "20.12.12",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-20.12.12.tgz",
+ "integrity": "sha512-eWLDGF/FOSPtAvEqeRAQ4C8LSA7M1I7i0ky1I8U7kD1J5ITyW3AsRhQrKVoWf5pFKZ2kILsEGJhsI9r93PYnOw==",
+ "dev": true,
+ "dependencies": {
+ "undici-types": "~5.26.4"
+ }
+ },
+ "node_modules/@inquirer/core/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/@inquirer/core/node_modules/signal-exit": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz",
+ "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==",
+ "dev": true,
+ "engines": {
+ "node": ">=14"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/isaacs"
+ }
+ },
+ "node_modules/@inquirer/core/node_modules/wrap-ansi": {
+ "version": "6.2.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
+ "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
+ "dev": true,
+ "dependencies": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "engines": {
+ "node": ">=8"
+ }
+ },
+ "node_modules/@inquirer/figures": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/@inquirer/figures/-/figures-1.0.2.tgz",
+ "integrity": "sha512-4F1MBwVr3c/m4bAUef6LgkvBfSjzwH+OfldgHqcuacWwSUetFebM2wi58WfG9uk1rR98U6GwLed4asLJbwdV5w==",
+ "dev": true,
+ "engines": {
+ "node": ">=18"
+ }
+ },
+ "node_modules/@inquirer/type": {
+ "version": "1.3.2",
+ "resolved": "https://registry.npmjs.org/@inquirer/type/-/type-1.3.2.tgz",
+ "integrity": "sha512-5Frickan9c89QbPkSu6I6y8p+9eR6hZkdPahGmNDsTFX8FHLPAozyzCZMKUeW8FyYwnlCKUjqIEqxY+UctARiw==",
+ "dev": true,
+ "engines": {
+ "node": ">=18"
+ }
+ },
"node_modules/@istanbuljs/load-nyc-config": {
"version": "1.1.0",
"resolved": "https://registry.npmjs.org/@istanbuljs/load-nyc-config/-/load-nyc-config-1.1.0.tgz",
@@ -1399,44 +1524,29 @@
"dev": true
},
"node_modules/@mswjs/cookies": {
- "version": "0.2.2",
- "resolved": "https://registry.npmjs.org/@mswjs/cookies/-/cookies-0.2.2.tgz",
- "integrity": "sha512-mlN83YSrcFgk7Dm1Mys40DLssI1KdJji2CMKN8eOlBqsTADYzj2+jWzsANsUTFbxDMWPD5e9bfA1RGqBpS3O1g==",
+ "version": "1.1.0",
+ "resolved": "https://registry.npmjs.org/@mswjs/cookies/-/cookies-1.1.0.tgz",
+ "integrity": "sha512-0ZcCVQxifZmhwNBoQIrystCb+2sWBY2Zw8lpfJBPCHGCA/HWqehITeCRVIv4VMy8MPlaHo2w2pTHFV2pFfqKPw==",
"dev": true,
- "dependencies": {
- "@types/set-cookie-parser": "^2.4.0",
- "set-cookie-parser": "^2.4.6"
- },
"engines": {
- "node": ">=14"
+ "node": ">=18"
}
},
"node_modules/@mswjs/interceptors": {
- "version": "0.17.10",
- "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.17.10.tgz",
- "integrity": "sha512-N8x7eSLGcmUFNWZRxT1vsHvypzIRgQYdG0rJey/rZCy6zT/30qDt8Joj7FxzGNLSwXbeZqJOMqDurp7ra4hgbw==",
+ "version": "0.29.1",
+ "resolved": "https://registry.npmjs.org/@mswjs/interceptors/-/interceptors-0.29.1.tgz",
+ "integrity": "sha512-3rDakgJZ77+RiQUuSK69t1F0m8BQKA8Vh5DCS5V0DWvNY67zob2JhhQrhCO0AKLGINTRSFd1tBaHcJTkhefoSw==",
"dev": true,
"dependencies": {
- "@open-draft/until": "^1.0.3",
- "@types/debug": "^4.1.7",
- "@xmldom/xmldom": "^0.8.3",
- "debug": "^4.3.3",
- "headers-polyfill": "3.2.5",
+ "@open-draft/deferred-promise": "^2.2.0",
+ "@open-draft/logger": "^0.3.0",
+ "@open-draft/until": "^2.0.0",
+ "is-node-process": "^1.2.0",
"outvariant": "^1.2.1",
- "strict-event-emitter": "^0.2.4",
- "web-encoding": "^1.1.5"
+ "strict-event-emitter": "^0.5.1"
},
"engines": {
- "node": ">=14"
- }
- },
- "node_modules/@mswjs/interceptors/node_modules/strict-event-emitter": {
- "version": "0.2.8",
- "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.2.8.tgz",
- "integrity": "sha512-KDf/ujU8Zud3YaLtMCcTI4xkZlZVIYxTLr+XIULexP+77EEVWixeXroLUXQXiVtH4XH2W7jr/3PT1v3zBuvc3A==",
- "dev": true,
- "dependencies": {
- "events": "^3.3.0"
+ "node": ">=18"
}
},
"node_modules/@nightwatch/chai": {
@@ -1557,10 +1667,26 @@
"resolved": "https://registry.npmjs.org/@nypl/dgx-svg-icons/-/dgx-svg-icons-0.3.4.tgz",
"integrity": "sha512-B4nPRkGSvzUiObFIEfq+dkSWgBhK56EFxYor5SCcY/A+rWsuGSNq22JlN6wDU/gsA6x0txxVJlUjUhtfwso/qQ=="
},
+ "node_modules/@open-draft/deferred-promise": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz",
+ "integrity": "sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA==",
+ "dev": true
+ },
+ "node_modules/@open-draft/logger": {
+ "version": "0.3.0",
+ "resolved": "https://registry.npmjs.org/@open-draft/logger/-/logger-0.3.0.tgz",
+ "integrity": "sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ==",
+ "dev": true,
+ "dependencies": {
+ "is-node-process": "^1.2.0",
+ "outvariant": "^1.4.0"
+ }
+ },
"node_modules/@open-draft/until": {
- "version": "1.0.3",
- "resolved": "https://registry.npmjs.org/@open-draft/until/-/until-1.0.3.tgz",
- "integrity": "sha512-Aq58f5HiWdyDlFffbbSjAlv596h/cOnt2DO1w3DOC7OJ5EHs0hd/nycJfiu9RJbT6Yk6F1knnRRXNSpxoIVZ9Q==",
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/@open-draft/until/-/until-2.1.0.tgz",
+ "integrity": "sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg==",
"dev": true
},
"node_modules/@react-dnd/asap": {
@@ -2050,9 +2176,9 @@
}
},
"node_modules/@types/cookie": {
- "version": "0.4.1",
- "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.4.1.tgz",
- "integrity": "sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q==",
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.6.0.tgz",
+ "integrity": "sha512-4Kh9a6B2bQciAhf7FSuMRRkUWecJgJu9nPnx3yzpsfXX/c50REIqpHY4C82bXP90qrLtXtkDxTZosYO3UpOwlA==",
"dev": true
},
"node_modules/@types/d3-path": {
@@ -2070,15 +2196,6 @@
"@types/d3-path": "^1"
}
},
- "node_modules/@types/debug": {
- "version": "4.1.12",
- "resolved": "https://registry.npmjs.org/@types/debug/-/debug-4.1.12.tgz",
- "integrity": "sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ==",
- "dev": true,
- "dependencies": {
- "@types/ms": "*"
- }
- },
"node_modules/@types/eslint": {
"version": "8.56.10",
"resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-8.56.10.tgz",
@@ -2244,12 +2361,6 @@
"integrity": "sha512-/LLMVyas0ljjAtoYiPqYiL8VWXzUUdThrmU5+n20DZv+a+ClRoevUzw5JxU+Ieh5/c87ytoTBV9G1FiKfNJdmg==",
"dev": true
},
- "node_modules/@types/js-levenshtein": {
- "version": "1.1.3",
- "resolved": "https://registry.npmjs.org/@types/js-levenshtein/-/js-levenshtein-1.1.3.tgz",
- "integrity": "sha512-jd+Q+sD20Qfu9e2aEXogiO3vpOC1PYJOUdyN9gvs4Qrvkg4wF43L5OhqrPeokdv8TL0/mXoYfpkcoGZMNN2pkQ==",
- "dev": true
- },
"node_modules/@types/jsdom": {
"version": "20.0.1",
"resolved": "https://registry.npmjs.org/@types/jsdom/-/jsdom-20.0.1.tgz",
@@ -2294,11 +2405,14 @@
"integrity": "sha512-dJvrYWxP/UcXm36Qn36fxhUKu8A/xMRXVT2cliFF1Z7UA9liG5Psj3ezNSZw+5puH2czDXRLcXQxf8JbJt0ejg==",
"dev": true
},
- "node_modules/@types/ms": {
- "version": "0.7.34",
- "resolved": "https://registry.npmjs.org/@types/ms/-/ms-0.7.34.tgz",
- "integrity": "sha512-nG96G3Wp6acyAgJqGasjODb+acrI7KltPiRxzHPXnP3NgI28bpQDRv53olbqGXbfcgF5aiiHmO3xpwEpS5Ld9g==",
- "dev": true
+ "node_modules/@types/mute-stream": {
+ "version": "0.0.4",
+ "resolved": "https://registry.npmjs.org/@types/mute-stream/-/mute-stream-0.0.4.tgz",
+ "integrity": "sha512-CPM9nzrCPPJHQNA9keH9CVkVI+WR5kMa+7XEs5jcGQ0VoAGnLv242w8lIVgwAEfmE4oufJRaTc9PNLQl0ioAow==",
+ "dev": true,
+ "dependencies": {
+ "@types/node": "*"
+ }
},
"node_modules/@types/node": {
"version": "18.19.33",
@@ -2461,15 +2575,6 @@
"@types/send": "*"
}
},
- "node_modules/@types/set-cookie-parser": {
- "version": "2.4.7",
- "resolved": "https://registry.npmjs.org/@types/set-cookie-parser/-/set-cookie-parser-2.4.7.tgz",
- "integrity": "sha512-+ge/loa0oTozxip6zmhRIk8Z/boU51wl9Q6QdLZcokIGMzY5lFXYy/x7Htj2HTC6/KZP1hUbZ1ekx8DYXICvWg==",
- "dev": true,
- "dependencies": {
- "@types/node": "*"
- }
- },
"node_modules/@types/sockjs": {
"version": "0.3.36",
"resolved": "https://registry.npmjs.org/@types/sockjs/-/sockjs-0.3.36.tgz",
@@ -2485,6 +2590,12 @@
"integrity": "sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw==",
"dev": true
},
+ "node_modules/@types/statuses": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/@types/statuses/-/statuses-2.0.5.tgz",
+ "integrity": "sha512-jmIUGWrAiwu3dZpxntxieC+1n/5c3mjrImkmOSQ2NC5uP6cYO4aAZDdSmRcI5C1oiTmqlZGHC+/NmJrKogbP5A==",
+ "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",
@@ -2500,6 +2611,12 @@
"integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==",
"dev": true
},
+ "node_modules/@types/wrap-ansi": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/@types/wrap-ansi/-/wrap-ansi-3.0.0.tgz",
+ "integrity": "sha512-ltIpx+kM7g/MLRZfkbL7EsCEjfzCcScLpkg37eXEtx5kmrAKBkTJwd1GIAjDSL8wTpM6Hzn5YO4pSb91BEwu1g==",
+ "dev": true
+ },
"node_modules/@types/ws": {
"version": "8.5.10",
"resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.5.10.tgz",
@@ -2902,15 +3019,6 @@
}
}
},
- "node_modules/@xmldom/xmldom": {
- "version": "0.8.10",
- "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz",
- "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==",
- "dev": true,
- "engines": {
- "node": ">=10.0.0"
- }
- },
"node_modules/@xtuc/ieee754": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/@xtuc/ieee754/-/ieee754-1.2.0.tgz",
@@ -2923,13 +3031,6 @@
"integrity": "sha512-NuHqBY1PB/D8xU6s/thBgOAiAP7HOYDQ32+BFZILJ8ivkUkAHQnWfn6WhL79Owj1qmUnoN/YPhktdIoucipkAQ==",
"dev": true
},
- "node_modules/@zxing/text-encoding": {
- "version": "0.9.0",
- "resolved": "https://registry.npmjs.org/@zxing/text-encoding/-/text-encoding-0.9.0.tgz",
- "integrity": "sha512-U/4aVJ2mxI0aDNI8Uq0wEhMgY+u4CNtEb0om3+y3+niDAsoTCOB33UF0sxpzqzdqXLqmvc+vZyAt4O8pPdfkwA==",
- "dev": true,
- "optional": true
- },
"node_modules/abab": {
"version": "2.0.6",
"resolved": "https://registry.npmjs.org/abab/-/abab-2.0.6.tgz",
@@ -4390,12 +4491,6 @@
"node": ">=10"
}
},
- "node_modules/chardet": {
- "version": "0.7.0",
- "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz",
- "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA==",
- "dev": true
- },
"node_modules/check-error": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/check-error/-/check-error-1.0.3.tgz",
@@ -4607,12 +4702,12 @@
}
},
"node_modules/cli-width": {
- "version": "3.0.0",
- "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz",
- "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw==",
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-4.1.0.tgz",
+ "integrity": "sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ==",
"dev": true,
"engines": {
- "node": ">= 10"
+ "node": ">= 12"
}
},
"node_modules/cliui": {
@@ -4916,9 +5011,9 @@
"dev": true
},
"node_modules/cookie": {
- "version": "0.4.2",
- "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.2.tgz",
- "integrity": "sha512-aSWTXFzaKWkvHO1Ny/s+ePFpvKsPnjc551iI41v3ny/ow6tBG5Vd+FuqGNhh1LxOmVzOlGUriIlOaokOvhaStA==",
+ "version": "0.5.0",
+ "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.5.0.tgz",
+ "integrity": "sha512-YZ3GUyn/o8gfKJlnlX7g7xq4gyO6OSuhGPKaaGssGB2qgDUS0gPgtTvoyZLTt9Ab6dC4hfc9dV5arkvc/OCmrw==",
"dev": true,
"engines": {
"node": ">= 0.6"
@@ -7136,20 +7231,6 @@
"resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz",
"integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g=="
},
- "node_modules/external-editor": {
- "version": "3.1.0",
- "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz",
- "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==",
- "dev": true,
- "dependencies": {
- "chardet": "^0.7.0",
- "iconv-lite": "^0.4.24",
- "tmp": "^0.0.33"
- },
- "engines": {
- "node": ">=4"
- }
- },
"node_modules/extsprintf": {
"version": "1.3.0",
"resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.3.0.tgz",
@@ -7355,28 +7436,55 @@
"dev": true,
"hasInstallScript": true
},
- "node_modules/figures": {
- "version": "3.2.0",
- "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz",
- "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==",
+ "node_modules/fetch-ponyfill": {
+ "version": "7.1.0",
+ "resolved": "https://registry.npmjs.org/fetch-ponyfill/-/fetch-ponyfill-7.1.0.tgz",
+ "integrity": "sha512-FhbbL55dj/qdVO3YNK7ZEkshvj3eQ7EuIGV2I6ic/2YiocvyWv+7jg2s4AyS0wdRU75s3tA8ZxI/xPigb0v5Aw==",
+ "dev": true,
+ "dependencies": {
+ "node-fetch": "~2.6.1"
+ }
+ },
+ "node_modules/fetch-ponyfill/node_modules/node-fetch": {
+ "version": "2.6.13",
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.13.tgz",
+ "integrity": "sha512-StxNAxh15zr77QvvkmveSQ8uCQ4+v5FkvNTj0OESmiHu+VRi/gXArXtkWMElOsOUNLtUEvI4yS+rdtOHZTwlQA==",
"dev": true,
"dependencies": {
- "escape-string-regexp": "^1.0.5"
+ "whatwg-url": "^5.0.0"
},
"engines": {
- "node": ">=8"
+ "node": "4.x || >=6.0.0"
},
- "funding": {
- "url": "https://github.com/sponsors/sindresorhus"
+ "peerDependencies": {
+ "encoding": "^0.1.0"
+ },
+ "peerDependenciesMeta": {
+ "encoding": {
+ "optional": true
+ }
}
},
- "node_modules/figures/node_modules/escape-string-regexp": {
- "version": "1.0.5",
- "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
- "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==",
+ "node_modules/fetch-ponyfill/node_modules/tr46": {
+ "version": "0.0.3",
+ "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
+ "integrity": "sha512-N3WMsuqV66lT30CrXNbEjx4GEwlow3v6rr4mCcv6prnfwhS01rkgyFdjPNBYd9br7LpXV1+Emh01fHnq2Gdgrw==",
+ "dev": true
+ },
+ "node_modules/fetch-ponyfill/node_modules/webidl-conversions": {
+ "version": "3.0.1",
+ "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
+ "integrity": "sha512-2JAn3z8AR6rjK8Sm8orRC0h/bcl/DqL7tRPdGZ4I1CjdF+EaMLmYxBHyXuKL849eucPFhvBoxMsflfOb8kxaeQ==",
+ "dev": true
+ },
+ "node_modules/fetch-ponyfill/node_modules/whatwg-url": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
+ "integrity": "sha512-saE57nupxk6v3HY35+jzBwYa0rKSy0XR8JSxZPwgLr7ys0IBzhGviA1/TUGJLmSVqs8pb9AnvICXEuOHLprYTw==",
"dev": true,
- "engines": {
- "node": ">=0.8.0"
+ "dependencies": {
+ "tr46": "~0.0.3",
+ "webidl-conversions": "^3.0.0"
}
},
"node_modules/file-entry-cache": {
@@ -8222,9 +8330,9 @@
}
},
"node_modules/headers-polyfill": {
- "version": "3.2.5",
- "resolved": "https://registry.npmjs.org/headers-polyfill/-/headers-polyfill-3.2.5.tgz",
- "integrity": "sha512-tUCGvt191vNSQgttSyJoibR+VO+I6+iCHIUdhzEMJKE+EAL8BwCN7fUOZlY4ofOelNHsK+gEjxB/B+9N3EWtdA==",
+ "version": "4.0.3",
+ "resolved": "https://registry.npmjs.org/headers-polyfill/-/headers-polyfill-4.0.3.tgz",
+ "integrity": "sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ==",
"dev": true
},
"node_modules/history": {
@@ -8745,62 +8853,6 @@
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
- "node_modules/inquirer": {
- "version": "8.2.6",
- "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-8.2.6.tgz",
- "integrity": "sha512-M1WuAmb7pn9zdFRtQYk26ZBoY043Sse0wVDdk4Bppr+JOXyQYybdtvK+l9wUibhtjdjvtoiNy8tk+EgsYIUqKg==",
- "dev": true,
- "dependencies": {
- "ansi-escapes": "^4.2.1",
- "chalk": "^4.1.1",
- "cli-cursor": "^3.1.0",
- "cli-width": "^3.0.0",
- "external-editor": "^3.0.3",
- "figures": "^3.0.0",
- "lodash": "^4.17.21",
- "mute-stream": "0.0.8",
- "ora": "^5.4.1",
- "run-async": "^2.4.0",
- "rxjs": "^7.5.5",
- "string-width": "^4.1.0",
- "strip-ansi": "^6.0.0",
- "through": "^2.3.6",
- "wrap-ansi": "^6.0.1"
- },
- "engines": {
- "node": ">=12.0.0"
- }
- },
- "node_modules/inquirer/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/inquirer/node_modules/wrap-ansi": {
- "version": "6.2.0",
- "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-6.2.0.tgz",
- "integrity": "sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA==",
- "dev": true,
- "dependencies": {
- "ansi-styles": "^4.0.0",
- "string-width": "^4.1.0",
- "strip-ansi": "^6.0.0"
- },
- "engines": {
- "node": ">=8"
- }
- },
"node_modules/internal-slot": {
"version": "1.0.7",
"resolved": "https://registry.npmjs.org/internal-slot/-/internal-slot-1.0.7.tgz",
@@ -10739,15 +10791,6 @@
"resolved": "https://registry.npmjs.org/js-cookie/-/js-cookie-2.2.1.tgz",
"integrity": "sha512-HvdH2LzI/EAZcUwA8+0nKNtWHqS+ZmijLA30RwZA0bo7ToCckjK5MkGhjED9KoRcXO6BaGI3I9UIzSA1FKFPOQ=="
},
- "node_modules/js-levenshtein": {
- "version": "1.1.6",
- "resolved": "https://registry.npmjs.org/js-levenshtein/-/js-levenshtein-1.1.6.tgz",
- "integrity": "sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g==",
- "dev": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
"node_modules/js-tokens": {
"version": "4.0.0",
"resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz",
@@ -12159,44 +12202,41 @@
"integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
},
"node_modules/msw": {
- "version": "1.3.3",
- "resolved": "https://registry.npmjs.org/msw/-/msw-1.3.3.tgz",
- "integrity": "sha512-CiPyRFiYJCXYyH/vwxT7m+sa4VZHuUH6cGwRBj0kaTjBGpsk4EnL47YzhoA859htVCF2vzqZuOsomIUlFqg9GQ==",
+ "version": "2.3.0",
+ "resolved": "https://registry.npmjs.org/msw/-/msw-2.3.0.tgz",
+ "integrity": "sha512-cDr1q/QTMzaWhY8n9lpGhceY209k29UZtdTgJ3P8Bzne3TSMchX2EM/ldvn4ATLOktpCefCU2gcEgzHc31GTPw==",
"dev": true,
"hasInstallScript": true,
"dependencies": {
- "@mswjs/cookies": "^0.2.2",
- "@mswjs/interceptors": "^0.17.10",
- "@open-draft/until": "^1.0.3",
- "@types/cookie": "^0.4.1",
- "@types/js-levenshtein": "^1.1.1",
- "chalk": "^4.1.1",
- "chokidar": "^3.4.2",
- "cookie": "^0.4.2",
+ "@bundled-es-modules/cookie": "^2.0.0",
+ "@bundled-es-modules/statuses": "^1.0.1",
+ "@inquirer/confirm": "^3.0.0",
+ "@mswjs/cookies": "^1.1.0",
+ "@mswjs/interceptors": "^0.29.0",
+ "@open-draft/until": "^2.1.0",
+ "@types/cookie": "^0.6.0",
+ "@types/statuses": "^2.0.4",
+ "chalk": "^4.1.2",
"graphql": "^16.8.1",
- "headers-polyfill": "3.2.5",
- "inquirer": "^8.2.0",
+ "headers-polyfill": "^4.0.2",
"is-node-process": "^1.2.0",
- "js-levenshtein": "^1.1.6",
- "node-fetch": "^2.6.7",
- "outvariant": "^1.4.0",
+ "outvariant": "^1.4.2",
"path-to-regexp": "^6.2.0",
- "strict-event-emitter": "^0.4.3",
- "type-fest": "^2.19.0",
- "yargs": "^17.3.1"
+ "strict-event-emitter": "^0.5.1",
+ "type-fest": "^4.9.0",
+ "yargs": "^17.7.2"
},
"bin": {
"msw": "cli/index.js"
},
"engines": {
- "node": ">=14"
+ "node": ">=18"
},
"funding": {
- "type": "opencollective",
- "url": "https://opencollective.com/mswjs"
+ "url": "https://github.com/sponsors/mswjs"
},
"peerDependencies": {
- "typescript": ">= 4.4.x"
+ "typescript": ">= 4.7.x"
},
"peerDependenciesMeta": {
"typescript": {
@@ -12227,12 +12267,12 @@
"dev": true
},
"node_modules/msw/node_modules/type-fest": {
- "version": "2.19.0",
- "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-2.19.0.tgz",
- "integrity": "sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA==",
+ "version": "4.18.2",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-4.18.2.tgz",
+ "integrity": "sha512-+suCYpfJLAe4OXS6+PPXjW3urOS4IoP9waSiLuXfLgqZODKw/aWwASvzqE886wA0kQgGy0mIWyhd87VpqIy6Xg==",
"dev": true,
"engines": {
- "node": ">=12.20"
+ "node": ">=16"
},
"funding": {
"url": "https://github.com/sponsors/sindresorhus"
@@ -12252,10 +12292,13 @@
}
},
"node_modules/mute-stream": {
- "version": "0.0.8",
- "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz",
- "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==",
- "dev": true
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-1.0.0.tgz",
+ "integrity": "sha512-avsJQhyd+680gKXyG/sQc0nXaC6rBkPOfyHYcFb9+hdkqQkR9bdnkJ0AMZhke0oesPqIO+mFFJ+IdBc7mst4IA==",
+ "dev": true,
+ "engines": {
+ "node": "^14.17.0 || ^16.13.0 || >=18.0.0"
+ }
},
"node_modules/nanoid": {
"version": "3.3.7",
@@ -13361,15 +13404,6 @@
"node": ">=0.10.0"
}
},
- "node_modules/os-tmpdir": {
- "version": "1.0.2",
- "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
- "integrity": "sha512-D2FR03Vir7FIu45XBY20mTb+/ZSWB00sjU9jdQXt83gDrI4Ztz5Fs7/yy74g2N5SVQY4xY1qDr4rNddwYRVX0g==",
- "dev": true,
- "engines": {
- "node": ">=0.10.0"
- }
- },
"node_modules/outvariant": {
"version": "1.4.2",
"resolved": "https://registry.npmjs.org/outvariant/-/outvariant-1.4.2.tgz",
@@ -15125,15 +15159,6 @@
"node": ">=v0.9.0"
}
},
- "node_modules/run-async": {
- "version": "2.4.1",
- "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz",
- "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ==",
- "dev": true,
- "engines": {
- "node": ">=0.12.0"
- }
- },
"node_modules/run-parallel": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/run-parallel/-/run-parallel-1.2.0.tgz",
@@ -16161,12 +16186,6 @@
"node": ">= 0.8.0"
}
},
- "node_modules/set-cookie-parser": {
- "version": "2.6.0",
- "resolved": "https://registry.npmjs.org/set-cookie-parser/-/set-cookie-parser-2.6.0.tgz",
- "integrity": "sha512-RVnVQxTXuerk653XfuliOxBP81Sf0+qfQE73LIYKcyMYHG94AuH0kgrQpRDuTZnSmjpysHmzxJXKNfa6PjFhyQ==",
- "dev": true
- },
"node_modules/set-function-length": {
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/set-function-length/-/set-function-length-1.2.2.tgz",
@@ -16571,9 +16590,9 @@
}
},
"node_modules/strict-event-emitter": {
- "version": "0.4.6",
- "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.4.6.tgz",
- "integrity": "sha512-12KWeb+wixJohmnwNFerbyiBrAlq5qJLwIt38etRtKtmmHyDSoGlIqFE9wx+4IwG0aDjI7GV8tc8ZccjWZZtTg==",
+ "version": "0.5.1",
+ "resolved": "https://registry.npmjs.org/strict-event-emitter/-/strict-event-emitter-0.5.1.tgz",
+ "integrity": "sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ==",
"dev": true
},
"node_modules/strict-uri-encode": {
@@ -17129,18 +17148,6 @@
"resolved": "https://registry.npmjs.org/tinycolor2/-/tinycolor2-1.6.0.tgz",
"integrity": "sha512-XPaBkWQJdsf3pLKJV9p4qN/S+fm2Oj8AIPo1BTUhg5oxkvm9+SVEGFdhyOz7tTdUTfvxMiAs4sp6/eZO2Ew+pw=="
},
- "node_modules/tmp": {
- "version": "0.0.33",
- "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
- "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
- "dev": true,
- "dependencies": {
- "os-tmpdir": "~1.0.2"
- },
- "engines": {
- "node": ">=0.6.0"
- }
- },
"node_modules/tmpl": {
"version": "1.0.5",
"resolved": "https://registry.npmjs.org/tmpl/-/tmpl-1.0.5.tgz",
@@ -18164,31 +18171,6 @@
"defaults": "^1.0.3"
}
},
- "node_modules/web-encoding": {
- "version": "1.1.5",
- "resolved": "https://registry.npmjs.org/web-encoding/-/web-encoding-1.1.5.tgz",
- "integrity": "sha512-HYLeVCdJ0+lBYV2FvNZmv3HJ2Nt0QYXqZojk3d9FJOLkwnuhzM9tmamh8d7HPM8QqjKH8DeHkFTx+CFlWpZZDA==",
- "dev": true,
- "dependencies": {
- "util": "^0.12.3"
- },
- "optionalDependencies": {
- "@zxing/text-encoding": "0.9.0"
- }
- },
- "node_modules/web-encoding/node_modules/util": {
- "version": "0.12.5",
- "resolved": "https://registry.npmjs.org/util/-/util-0.12.5.tgz",
- "integrity": "sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA==",
- "dev": true,
- "dependencies": {
- "inherits": "^2.0.3",
- "is-arguments": "^1.0.4",
- "is-generator-function": "^1.0.7",
- "is-typed-array": "^1.1.3",
- "which-typed-array": "^1.1.2"
- }
- },
"node_modules/webidl-conversions": {
"version": "7.0.0",
"resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-7.0.0.tgz",
diff --git a/package.json b/package.json
index dcf5b6a56..1433c229d 100644
--- a/package.json
+++ b/package.json
@@ -100,6 +100,7 @@
"eslint-plugin-react-hooks": "^4.0.0",
"fetch-mock": "^7.3.1",
"fetch-mock-jest": "^1.5.1",
+ "fetch-ponyfill": "^7.1.0",
"file-loader": "^6.2.0",
"follow-redirects": "^1.15.6",
"husky": "^4.3.0",
@@ -110,7 +111,7 @@
"lint-staged": "^10.4.0",
"mini-css-extract-plugin": "1.6.0",
"mocha": "^10.2.0",
- "msw": "^1.2.1",
+ "msw": "^2.3.0",
"nightwatch": "^3.2.0",
"prettier": "2.1.2",
"react-axe": "^3.3.0",
diff --git a/tests/jest/components/CustomLists.test.tsx b/tests/jest/components/CustomLists.test.tsx
index f625273e6..212498a3d 100644
--- a/tests/jest/components/CustomLists.test.tsx
+++ b/tests/jest/components/CustomLists.test.tsx
@@ -1,9 +1,8 @@
import * as React from "react";
import { screen, waitFor } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
-
-import { rest } from "msw";
import { setupServer } from "msw/node";
+import { http, HttpResponse } from "msw";
import CustomLists from "../../../src/components/CustomLists";
import renderWithContext from "../testUtils/renderWithContext";
import buildStore from "../../../src/store";
@@ -15,8 +14,8 @@ describe("CustomLists", () => {
Element.prototype.scrollTo = () => {};
const server = setupServer(
- rest.get("*/search", (req, res, ctx) => res(ctx.xml(""))),
- rest.get("*", (req, res, ctx) => res(ctx.json({})))
+ http.get("*/search", () => HttpResponse.xml("")),
+ http.get("*", () => HttpResponse.json({}))
);
beforeAll(() => {
@@ -111,10 +110,10 @@ describe("CustomLists", () => {
let searchParams = null;
server.use(
- rest.get("*/search", (req, res, ctx) => {
- searchParams = req.url.searchParams;
-
- res(ctx.xml(""));
+ http.get("*/search", ({ request }) => {
+ const url = new URL(request.url);
+ searchParams = url.searchParams;
+ return HttpResponse.xml("");
})
);
@@ -154,10 +153,10 @@ describe("CustomLists", () => {
let searchParams = null;
server.use(
- rest.get("*/search", (req, res, ctx) => {
- searchParams = req.url.searchParams;
-
- res(ctx.xml(""));
+ http.get("*/search", ({ request }) => {
+ const url = new URL(request.url);
+ searchParams = url.searchParams;
+ return HttpResponse.xml("");
})
);
diff --git a/tests/jest/components/InventoryReportRequestModal.test.tsx b/tests/jest/components/InventoryReportRequestModal.test.tsx
index 62c70ae2a..2976e71d2 100644
--- a/tests/jest/components/InventoryReportRequestModal.test.tsx
+++ b/tests/jest/components/InventoryReportRequestModal.test.tsx
@@ -7,7 +7,7 @@ import {
} from "../testUtils/withProviders";
import { QueryClient } from "@tanstack/react-query";
import { setupServer } from "msw/node";
-import { rest } from "msw";
+import { http, HttpResponse } from "msw";
import {
ACK_RESPONSE_BUTTON_CONTENT,
ACK_RESPONSE_HEADING,
@@ -45,12 +45,12 @@ const API_ENDPOINT_PARAMS: AdminAPI.InventoryReportRequestParams = {
const setupMockServer = () => {
return setupServer(
- rest.get(MOCK_SERVER_API_ENDPOINT_PATH, async (_, res, ctx) => {
- return res(ctx.status(200), ctx.json(INFO_SUCCESS_SOME_COLLECTIONS));
- }),
- rest.post(MOCK_SERVER_API_ENDPOINT_PATH, async (_, res, ctx) => {
- return res(ctx.status(202), ctx.json(GENERATE_REPORT_SUCCESS));
- })
+ http.get(MOCK_SERVER_API_ENDPOINT_PATH, () =>
+ HttpResponse.json(INFO_SUCCESS_SOME_COLLECTIONS, { status: 200 })
+ ),
+ http.post(MOCK_SERVER_API_ENDPOINT_PATH, () =>
+ HttpResponse.json(GENERATE_REPORT_SUCCESS, { status: 202 })
+ )
);
};
@@ -252,8 +252,9 @@ describe("InventoryReportRequestModal", () => {
});
it("returns an error value for unsuccessful report info (get) requests", async () => {
server.use(
- rest.get(MOCK_SERVER_API_ENDPOINT_PATH, (_, res, ctx) =>
- res(ctx.status(404))
+ http.get(
+ MOCK_SERVER_API_ENDPOINT_PATH,
+ () => new HttpResponse(null, { status: 404 })
)
);
let error = undefined;
@@ -271,8 +272,9 @@ describe("InventoryReportRequestModal", () => {
});
it("returns an error value for unsuccessful generate report (post) requests", async () => {
server.use(
- rest.post(MOCK_SERVER_API_ENDPOINT_PATH, (_, res, ctx) =>
- res(ctx.status(404))
+ http.post(
+ MOCK_SERVER_API_ENDPOINT_PATH,
+ () => new HttpResponse(null, { status: 404 })
)
);
let error = undefined;
@@ -452,9 +454,9 @@ describe("InventoryReportRequestModal", () => {
it("disables report generation, if info indicates no collections", async () => {
server.use(
- rest.get(MOCK_SERVER_API_ENDPOINT_PATH, async (_, res, ctx) => {
- return res(ctx.status(200), ctx.json(INFO_SUCCESS_NO_COLLECTIONS));
- })
+ http.get(MOCK_SERVER_API_ENDPOINT_PATH, () =>
+ HttpResponse.json(INFO_SUCCESS_NO_COLLECTIONS, { status: 200 })
+ )
);
const {
@@ -499,8 +501,9 @@ describe("InventoryReportRequestModal", () => {
it("displays minimal confirmation message, if report info request unsuccessful", async () => {
server.use(
- rest.get(MOCK_SERVER_API_ENDPOINT_PATH, (_, res, ctx) =>
- res.once(ctx.status(404))
+ http.get(
+ MOCK_SERVER_API_ENDPOINT_PATH,
+ () => new HttpResponse(null, { status: 404 })
)
);
@@ -607,8 +610,9 @@ describe("InventoryReportRequestModal", () => {
it("displays error message, when request is unsuccessful", async () => {
server.use(
- rest.post(MOCK_SERVER_API_ENDPOINT_PATH, (_, res, ctx) =>
- res(ctx.status(404))
+ http.post(
+ MOCK_SERVER_API_ENDPOINT_PATH,
+ () => new HttpResponse(null, { status: 404 })
)
);
const user = userEvent.setup();
diff --git a/tests/jest/components/QuicksightDashboard.test.tsx b/tests/jest/components/QuicksightDashboard.test.tsx
index 0a54983f8..14fe5c73a 100644
--- a/tests/jest/components/QuicksightDashboard.test.tsx
+++ b/tests/jest/components/QuicksightDashboard.test.tsx
@@ -2,10 +2,10 @@ import * as React from "react";
import { screen, waitFor } from "@testing-library/react";
import QuicksightDashboard from "../../../src/components/QuicksightDashboard";
-import { LibrariesData, LibraryData } from "../../../src/interfaces";
-import buildStore, { RootState } from "../../../src/store";
+import { LibrariesData } from "../../../src/interfaces";
+import buildStore from "../../../src/store";
import { setupServer } from "msw/node";
-import { rest } from "msw";
+import { http, HttpResponse } from "msw";
import renderWithContext from "../testUtils/renderWithContext";
const libraries: LibrariesData = { libraries: [{ uuid: "my-uuid" }] };
@@ -15,15 +15,15 @@ const dashboardUrlData = { embedUrl: embedUrl };
describe("QuicksightDashboard", () => {
const server = setupServer(
- rest.get("*/admin/libraries", (req, res, ctx) => res(ctx.json(libraries))),
-
- rest.get(
- "*/admin/quicksight_embed/" +
- dashboardId +
- "?libraryUuids=" +
- libraries["libraries"][0]["uuid"],
- (req, res, ctx) => res(ctx.json(dashboardUrlData))
- )
+ http.get("/admin/libraries", () => HttpResponse.json(libraries)),
+ http.get(`/admin/quicksight_embed/${dashboardId}`, ({ request }) => {
+ const url = new URL(request.url);
+ const libraryUuids = url.searchParams.get("libraryUuids");
+
+ if (libraryUuids === libraries["libraries"][0]["uuid"]) {
+ return HttpResponse.json(dashboardUrlData);
+ }
+ })
);
beforeAll(() => {