From 3e8f1639adb489167b1d9c9250ee58ee053087b6 Mon Sep 17 00:00:00 2001 From: pd-redis Date: Thu, 16 Oct 2025 16:23:52 +0300 Subject: [PATCH 01/19] update ts and msw --- package.json | 4 +- .../ui/src/components/base/forms/FormField.ts | 3 - yarn.lock | 379 ++++++++---------- 3 files changed, 168 insertions(+), 218 deletions(-) delete mode 100644 redisinsight/ui/src/components/base/forms/FormField.ts diff --git a/package.json b/package.json index 917877050e..c21783dd05 100644 --- a/package.json +++ b/package.json @@ -207,7 +207,7 @@ "lint-staged": "^10.2.11", "mini-css-extract-plugin": "2.7.2", "moment": "^2.29.3", - "msw": "^1.3.4", + "msw": "^2.11.5", "patch-package": "^8.0.0", "postinstall-postinstall": "^2.1.0", "prettier": "3.5.2", @@ -230,7 +230,7 @@ "ts-node": "^10.9.1", "tsconfig-paths": "^3.9.0", "tsconfig-paths-webpack-plugin": "^4.1.0", - "typescript": "^4.0.5", + "typescript": "^4.9.5", "url-loader": "^4.1.0", "vite": "^5.4.20", "vite-bundle-visualizer": "1.0.1", diff --git a/redisinsight/ui/src/components/base/forms/FormField.ts b/redisinsight/ui/src/components/base/forms/FormField.ts deleted file mode 100644 index 09d1d5f368..0000000000 --- a/redisinsight/ui/src/components/base/forms/FormField.ts +++ /dev/null @@ -1,3 +0,0 @@ -import { FormField } from '@redis-ui/components' - -export { FormField } diff --git a/yarn.lock b/yarn.lock index 60ad553327..9f46330cb6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1553,13 +1553,42 @@ resolved "https://registry.yarnpkg.com/@humanwhocodes/object-schema/-/object-schema-2.0.3.tgz#4a2868d75d6d6963e423bcf90b7fd1be343409d3" integrity sha512-93zYdMES/c1D69yZiKDBj0V24vqNzB/koF26KPaagAfd3P/4gUlh3Dys5ogAK+Exi9QyzlD8x/08Zt7wIKcDcA== -"@inquirer/external-editor@^1.0.0": - version "1.0.2" - resolved "https://registry.yarnpkg.com/@inquirer/external-editor/-/external-editor-1.0.2.tgz#dc16e7064c46c53be09918db639ff780718c071a" - integrity sha512-yy9cOoBnx58TlsPrIxauKIFQTiyH+0MK4e97y4sV9ERbI+zDxw7i2hxHLCIEGIE/8PPvDxGhgzIOTSOWcs6/MQ== +"@inquirer/ansi@^1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@inquirer/ansi/-/ansi-1.0.1.tgz#994f7dd16a00c547a7b110e04bf4f4eca1857929" + integrity sha512-yqq0aJW/5XPhi5xOAL1xRCpe1eh8UFVgYFpFsjEqmIR8rKLyP+HINvFXwUaxYICflJrVlxnp7lLN6As735kVpw== + +"@inquirer/confirm@^5.0.0": + version "5.1.19" + resolved "https://registry.yarnpkg.com/@inquirer/confirm/-/confirm-5.1.19.tgz#bf28b420898999eb7479ab55623a3fbaf1453ff4" + integrity sha512-wQNz9cfcxrtEnUyG5PndC8g3gZ7lGDBzmWiXZkX8ot3vfZ+/BLjR8EvyGX4YzQLeVqtAlY/YScZpW7CW8qMoDQ== dependencies: - chardet "^2.1.0" - iconv-lite "^0.7.0" + "@inquirer/core" "^10.3.0" + "@inquirer/type" "^3.0.9" + +"@inquirer/core@^10.3.0": + version "10.3.0" + resolved "https://registry.yarnpkg.com/@inquirer/core/-/core-10.3.0.tgz#342e4fd62cbd33ea62089364274995dbec1f2ffe" + integrity sha512-Uv2aPPPSK5jeCplQmQ9xadnFx2Zhj9b5Dj7bU6ZeCdDNNY11nhYy4btcSdtDguHqCT2h5oNeQTcUNSGGLA7NTA== + dependencies: + "@inquirer/ansi" "^1.0.1" + "@inquirer/figures" "^1.0.14" + "@inquirer/type" "^3.0.9" + cli-width "^4.1.0" + mute-stream "^2.0.0" + signal-exit "^4.1.0" + wrap-ansi "^6.2.0" + yoctocolors-cjs "^2.1.2" + +"@inquirer/figures@^1.0.14": + version "1.0.14" + resolved "https://registry.yarnpkg.com/@inquirer/figures/-/figures-1.0.14.tgz#12a7bfd344a83ae6cc5d6004b389ed11f6db6be4" + integrity sha512-DbFgdt+9/OZYFM+19dbpXOSeAstPy884FPy1KjDu4anWwymZeOYhMY1mdFri172htv6mvc/uvIAAi7b7tvjJBQ== + +"@inquirer/type@^3.0.9": + version "3.0.9" + resolved "https://registry.yarnpkg.com/@inquirer/type/-/type-3.0.9.tgz#f7f9696e9276e4e1ae9332767afb9199992e31d9" + integrity sha512-QPaNt/nmE2bLGQa9b7wwyRJoLZ7pN6rcyXvzU0YCmivmJyq1BVo94G98tStRWkoD1RgDX5C+dPlhhHzNdu/W/w== "@isaacs/balanced-match@^4.0.1": version "4.0.1" @@ -1918,27 +1947,17 @@ resolved "https://registry.yarnpkg.com/@msgpackr-extract/msgpackr-extract-win32-x64/-/msgpackr-extract-win32-x64-3.0.2.tgz#0f164b726869f71da3c594171df5ebc1c4b0a407" integrity sha512-O+6Gs8UeDbyFpbSh2CPEz/UOrrdWPTBYNblZK5CxxLisYt4kGX3Sc+czffFonyjiGSq3jWLwJS/CCJc7tBr4sQ== -"@mswjs/cookies@^0.2.2": - version "0.2.2" - resolved "https://registry.yarnpkg.com/@mswjs/cookies/-/cookies-0.2.2.tgz#b4e207bf6989e5d5427539c2443380a33ebb922b" - integrity sha512-mlN83YSrcFgk7Dm1Mys40DLssI1KdJji2CMKN8eOlBqsTADYzj2+jWzsANsUTFbxDMWPD5e9bfA1RGqBpS3O1g== - dependencies: - "@types/set-cookie-parser" "^2.4.0" - set-cookie-parser "^2.4.6" - -"@mswjs/interceptors@^0.17.10": - version "0.17.10" - resolved "https://registry.yarnpkg.com/@mswjs/interceptors/-/interceptors-0.17.10.tgz#857b41f30e2b92345ed9a4e2b1d0a08b8b6fcad4" - integrity sha512-N8x7eSLGcmUFNWZRxT1vsHvypzIRgQYdG0rJey/rZCy6zT/30qDt8Joj7FxzGNLSwXbeZqJOMqDurp7ra4hgbw== +"@mswjs/interceptors@^0.39.1": + version "0.39.8" + resolved "https://registry.yarnpkg.com/@mswjs/interceptors/-/interceptors-0.39.8.tgz#0a2cf4cf26a731214ca4156273121f67dff7ebf8" + integrity sha512-2+BzZbjRO7Ct61k8fMNHEtoKjeWI9pIlHFTqBwZ5icHpqszIgEZbjb1MW5Z0+bITTCTl3gk4PDBxs9tA/csXvA== 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" - outvariant "^1.2.1" - strict-event-emitter "^0.2.4" - web-encoding "^1.1.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.4.3" + strict-event-emitter "^0.5.1" "@nicolo-ribaudo/eslint-scope-5-internals@5.1.1-v1": version "5.1.1-v1" @@ -1984,10 +2003,23 @@ mkdirp "^1.0.4" rimraf "^3.0.2" -"@open-draft/until@^1.0.3": - version "1.0.3" - resolved "https://registry.yarnpkg.com/@open-draft/until/-/until-1.0.3.tgz#db9cc719191a62e7d9200f6e7bab21c5b848adca" - integrity sha512-Aq58f5HiWdyDlFffbbSjAlv596h/cOnt2DO1w3DOC7OJ5EHs0hd/nycJfiu9RJbT6Yk6F1knnRRXNSpxoIVZ9Q== +"@open-draft/deferred-promise@^2.2.0": + version "2.2.0" + resolved "https://registry.yarnpkg.com/@open-draft/deferred-promise/-/deferred-promise-2.2.0.tgz#4a822d10f6f0e316be4d67b4d4f8c9a124b073bd" + integrity sha512-CecwLWx3rhxVQF6V4bAgPS5t+So2sTbPgAzafKkVizyi7tlwpcFpdFqq+wqF2OwNBmqFuu6tOyouTuxgpMfzmA== + +"@open-draft/logger@^0.3.0": + version "0.3.0" + resolved "https://registry.yarnpkg.com/@open-draft/logger/-/logger-0.3.0.tgz#2b3ab1242b360aa0adb28b85f5d7da1c133a0954" + integrity sha512-X2g45fzhxH238HKO4xbSr7+wBS8Fvw6ixhTDuvLd5mqh6bJJCFAPwU9mPDxbcrRtfxv4u5IHCEH77BmxvXmmxQ== + dependencies: + is-node-process "^1.2.0" + outvariant "^1.4.0" + +"@open-draft/until@^2.0.0": + version "2.1.0" + resolved "https://registry.yarnpkg.com/@open-draft/until/-/until-2.1.0.tgz#0acf32f470af2ceaf47f095cdecd40d68666efda" + integrity sha512-U69T3ItWHvLwGg5eJ0n3I62nWuE6ilHlmz7zM0npLBRvPRd7e6NYmg54vvRtP5mZG7kZqZCFVdsTWo7BPtBujg== "@pkgjs/parseargs@^0.11.0": version "0.11.0" @@ -3183,11 +3215,6 @@ dependencies: "@types/node" "*" -"@types/cookie@^0.4.1": - version "0.4.1" - resolved "https://registry.yarnpkg.com/@types/cookie/-/cookie-0.4.1.tgz#bfd02c1f2224567676c1545199f87c3a861d878d" - integrity sha512-XW/Aa8APYr6jSVVA1y/DEIZX0/GMKLEVekNG727R8cs56ahETkRAy/3DR7+fJyh7oUgGwNQaRfXCun0+KbWY7Q== - "@types/cookiejar@*": version "2.1.2" resolved "https://registry.yarnpkg.com/@types/cookiejar/-/cookiejar-2.1.2.tgz#66ad9331f63fe8a3d3d9d8c6e3906dd10f6446e8" @@ -3403,7 +3430,7 @@ "@types/d3-transition" "*" "@types/d3-zoom" "*" -"@types/debug@^4.0.0", "@types/debug@^4.1.6", "@types/debug@^4.1.7": +"@types/debug@^4.0.0", "@types/debug@^4.1.6": version "4.1.12" resolved "https://registry.yarnpkg.com/@types/debug/-/debug-4.1.12.tgz#a155f21690871953410df4b6b6f53187f0500917" integrity sha512-vIChWdVG3LG1SMxEvI/AK+FWJthlrqlTu7fbrlywTkkaONwk/UAGaULXRlf8vkzFBLVm0zkMdCquhL5aOjhXPQ== @@ -3585,11 +3612,6 @@ expect "^29.0.0" pretty-format "^29.0.0" -"@types/js-levenshtein@^1.1.1": - version "1.1.3" - resolved "https://registry.yarnpkg.com/@types/js-levenshtein/-/js-levenshtein-1.1.3.tgz#a6fd0bdc8255b274e5438e0bfb25f154492d1106" - integrity sha512-jd+Q+sD20Qfu9e2aEXogiO3vpOC1PYJOUdyN9gvs4Qrvkg4wF43L5OhqrPeokdv8TL0/mXoYfpkcoGZMNN2pkQ== - "@types/js-yaml@^4.0.9": version "4.0.9" resolved "https://registry.yarnpkg.com/@types/js-yaml/-/js-yaml-4.0.9.tgz#cd82382c4f902fed9691a2ed79ec68c5898af4c2" @@ -3915,18 +3937,16 @@ "@types/node" "*" "@types/send" "*" -"@types/set-cookie-parser@^2.4.0": - version "2.4.10" - resolved "https://registry.yarnpkg.com/@types/set-cookie-parser/-/set-cookie-parser-2.4.10.tgz#ad3a807d6d921db9720621ea3374c5d92020bcbc" - integrity sha512-GGmQVGpQWUe5qglJozEjZV/5dyxbOOZ0LHe/lqyWssB88Y4svNfst0uqBVscdDeIKl5Jy5+aPSvy7mI9tYRguw== - dependencies: - "@types/node" "*" - "@types/stack-utils@^2.0.0": version "2.0.3" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.3.tgz#6209321eb2c1712a7e7466422b8cb1fc0d9dd5d8" integrity sha512-9aEbYZ3TbYMznPdcdr3SmIrLXwC/AKZXQeCf9Pgao5CKb8CyHuEX5jzWPTkvregvhRJHcpRO6BFoGW9ycaOkYw== +"@types/statuses@^2.0.4": + version "2.0.6" + resolved "https://registry.yarnpkg.com/@types/statuses/-/statuses-2.0.6.tgz#66748315cc9a96d63403baa8671b2c124f8633aa" + integrity sha512-xMAgYwceFhRA2zY+XbEA7mxYbA093wdiW8Vu6gZPGWy9cmOyU9XesH1tNcEWsKFd5Vzrqx5T3D38PWx1FIIXkA== + "@types/styled-components@^5.1.34": version "5.1.34" resolved "https://registry.yarnpkg.com/@types/styled-components/-/styled-components-5.1.34.tgz#4107df8ef8a7eaba4fa6b05f78f93fba4daf0300" @@ -4426,7 +4446,7 @@ resolved "https://registry.yarnpkg.com/@webpack-cli/serve/-/serve-2.0.5.tgz#325db42395cd49fe6c14057f9a900e427df8810e" integrity sha512-lqaoKnRYBdo1UgDX8uF24AfGMifWK19TxPmM5FHc2vAGxrJ/qtyUyFBWoY1tISZdelsQ5fBcOusifo5o5wSJxQ== -"@xmldom/xmldom@^0.8.3", "@xmldom/xmldom@^0.8.8": +"@xmldom/xmldom@^0.8.8": version "0.8.11" resolved "https://registry.yarnpkg.com/@xmldom/xmldom/-/xmldom-0.8.11.tgz#b79de2d67389734c57c52595f7a7305e30c2d608" integrity sha512-cQzWCtO6C8TQiYl1ruKNn2U6Ao4o4WBBcbL61yJl84x+j5sOWWFU9X7DpND8XZG3daDppSsigMdfAIl2upQBRw== @@ -4446,11 +4466,6 @@ resolved "https://registry.yarnpkg.com/@yarnpkg/lockfile/-/lockfile-1.1.0.tgz#e77a97fbd345b76d83245edcd17d393b1b41fb31" integrity sha512-GpSwvyXOcOOlV70vbnzjj4fW5xW/FdUF6nQEt1ENy7m4ZCczi1+/buVUPAqmGfqznsORNFzUMjctTIp8a9tuCQ== -"@zxing/text-encoding@0.9.0": - version "0.9.0" - resolved "https://registry.yarnpkg.com/@zxing/text-encoding/-/text-encoding-0.9.0.tgz#fb50ffabc6c7c66a0c96b4c03e3d9be74864b70b" - integrity sha512-U/4aVJ2mxI0aDNI8Uq0wEhMgY+u4CNtEb0om3+y3+niDAsoTCOB33UF0sxpzqzdqXLqmvc+vZyAt4O8pPdfkwA== - abab@^2.0.6: version "2.0.6" resolved "https://registry.yarnpkg.com/abab/-/abab-2.0.6.tgz#41b80f2c871d19686216b82309231cfd3cb3d291" @@ -4606,7 +4621,7 @@ ansi-styles@^6.1.0: resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-6.2.1.tgz#0e62320cf99c21afff3b3012192546aacbfb05c5" integrity sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug== -anymatch@^3.0.3, anymatch@~3.1.2: +anymatch@^3.0.3: version "3.1.3" resolved "https://registry.yarnpkg.com/anymatch/-/anymatch-3.1.3.tgz#790c58b19ba1720a84205b57c618d5ad8524973e" integrity sha512-KMReFUr0B4t+D+OBkjR3KYqvocp2XaSzO55UcB6mgQMd3KbcE+mWTyvVV7D/zsdEbNnV6acZUutkiHQXvTr1Rw== @@ -5097,11 +5112,6 @@ bignumber.js@^9.0.0: resolved "https://registry.yarnpkg.com/bignumber.js/-/bignumber.js-9.1.1.tgz#c4df7dc496bd849d4c9464344c1aa74228b4dac6" integrity sha512-pHm4LsMJ6lzgNGVfZHjMoO8sdoRhOzOH4MLmY65Jg70bpxCKu5iOHNJyfF6OyvYw7t8Fpf35RuzUyqnQsj8Vig== -binary-extensions@^2.0.0: - version "2.3.0" - resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.3.0.tgz#f6e14a97858d327252200242d4ccfe522c445522" - integrity sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw== - bl@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/bl/-/bl-4.1.0.tgz#451535264182bec2fbbc83a62ab98cf11d9f7b3a" @@ -5141,7 +5151,7 @@ brace@^0.11.1: resolved "https://registry.yarnpkg.com/brace/-/brace-0.11.1.tgz#4896fcc9d544eef45f4bb7660db320d3b379fe58" integrity sha512-Fc8Ne62jJlKHiG/ajlonC4Sd66Pq68fFwK4ihJGNZpGqboc324SQk+lRvMzpPRuJOmfrJefdG8/7JdWX4bzJ2Q== -braces@^3.0.3, braces@~3.0.2: +braces@^3.0.3: version "3.0.3" resolved "https://registry.yarnpkg.com/braces/-/braces-3.0.3.tgz#490332f40919452272d55a8480adc0c441358789" integrity sha512-yQbXgO/OSZVD2IsiLlro+7Hf6Q18EJrKSEsdoMzKePKXct3gvD8oLcOQdIzGupr5Fj+EDe8gO/lxc1BzfMpxvA== @@ -5458,31 +5468,11 @@ character-reference-invalid@^1.0.0: resolved "https://registry.yarnpkg.com/character-reference-invalid/-/character-reference-invalid-1.1.4.tgz#083329cda0eae272ab3dbbf37e9a382c13af1560" integrity sha512-mKKUkUbhPpQlCOfIuZkvSEgktjPFIsZKRRbC6KWVEMvlzblj3i3asQv5ODsrwt0N3pHAEvjP8KTQPHkp0+6jOg== -chardet@^2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/chardet/-/chardet-2.1.0.tgz#1007f441a1ae9f9199a4a67f6e978fb0aa9aa3fe" - integrity sha512-bNFETTG/pM5ryzQ9Ad0lJOTa6HWD/YsScAR3EnCPZRPlQh77JocYktSHOUHelyhm8IARL+o4c4F1bP5KVOjiRA== - check-error@^2.1.1: version "2.1.1" resolved "https://registry.yarnpkg.com/check-error/-/check-error-2.1.1.tgz#87eb876ae71ee388fa0471fe423f494be1d96ccc" integrity sha512-OAlb+T7V4Op9OwdkjmguYRqncdlx5JiofwOAUkmTF+jNdHwzTaTs4sRAGpzLF3oOz5xAyDGrPgeIDFQmDOTiJw== -chokidar@^3.4.2: - version "3.6.0" - resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-3.6.0.tgz#197c6cc669ef2a8dc5e7b4d97ee4e092c3eb0d5b" - integrity sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw== - dependencies: - anymatch "~3.1.2" - braces "~3.0.2" - glob-parent "~5.1.2" - is-binary-path "~2.1.0" - is-glob "~4.0.1" - normalize-path "~3.0.0" - readdirp "~3.6.0" - optionalDependencies: - fsevents "~2.3.2" - chownr@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/chownr/-/chownr-2.0.0.tgz#15bfbe53d2eab4cf70f18a8cd68ebe5b3cb1dece" @@ -5550,10 +5540,10 @@ cli-truncate@^2.1.0: slice-ansi "^3.0.0" string-width "^4.2.0" -cli-width@^3.0.0: - version "3.0.0" - resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-3.0.0.tgz#a2f48437a2caa9a22436e794bf071ec9e61cedf6" - integrity sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw== +cli-width@^4.1.0: + version "4.1.0" + resolved "https://registry.yarnpkg.com/cli-width/-/cli-width-4.1.0.tgz#42daac41d3c254ef38ad8ac037672130173691c5" + integrity sha512-ouuZd4/dm2Sw5Gmqy6bGyNNNe1qt9RpmxveLSO7KcgsTnU7RXfsw+/bukWGo1abgBiMAic068rclZsO4IWmmxQ== cliui@^7.0.2: version "7.0.4" @@ -5791,7 +5781,7 @@ convert-source-map@^2.0.0: resolved "https://registry.yarnpkg.com/convert-source-map/-/convert-source-map-2.0.0.tgz#4b560f649fc4e918dd0ab75cf4961e8bc882d82a" integrity sha512-Kvp459HrV2FEJ1CAsi1Ku+MY3kasH19TFykTz2xWmMeq6bk2NU3XXvfJ+Q61m0xktWwt+1HSYf3JZsTms3aRJg== -cookie@^0.4.2, cookie@^0.7.0: +cookie@^0.7.0, cookie@^1.0.2: version "0.7.2" resolved "https://registry.yarnpkg.com/cookie/-/cookie-0.7.2.tgz#556369c472a2ba910f2979891b526b3436237ed7" integrity sha512-yki5XnKuf750l50uGTllt6kKILY4nQ1eNIQatoXEByZ5dWgnKqbnqmTrBE5B4N7lrMJKQ2ytWMiTO2o0v6Ew/w== @@ -7789,7 +7779,7 @@ esutils@^2.0.2: resolved "https://registry.yarnpkg.com/esutils/-/esutils-2.0.3.tgz#74d2eb4de0b8da1293711910d50775b9b710ef64" integrity sha512-kVscqXk4OCp68SZ0dkgEKVi6/8ij300KBWTJq32P/dYeWTSwK41WyTxalN1eRmA5Z9UU/LX9D7FWSmV9SAYx6g== -events@^3.2.0, events@^3.3.0: +events@^3.2.0: version "3.3.0" resolved "https://registry.yarnpkg.com/events/-/events-3.3.0.tgz#31a95ad0a924e2d2c419a813aeb2c4e878ea7400" integrity sha512-mQw+2fkQbALzQ7V0MY0IqdnXNOeTtP4r0lN9z7AAawCXgqea7bDii20AYrIBrFd/Hx0M2Ocz6S111CaFkUcb0Q== @@ -7967,13 +7957,6 @@ fengari@^0.1.4: sprintf-js "^1.1.1" tmp "^0.0.33" -figures@^3.0.0: - version "3.2.0" - resolved "https://registry.yarnpkg.com/figures/-/figures-3.2.0.tgz#625c18bd293c604dc4a8ddb2febf0c88341746af" - integrity sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg== - dependencies: - escape-string-regexp "^1.0.5" - file-entry-cache@^6.0.1: version "6.0.1" resolved "https://registry.yarnpkg.com/file-entry-cache/-/file-entry-cache-6.0.1.tgz#211b2dd9659cb0394b073e7323ac3c933d522027" @@ -8319,7 +8302,7 @@ get-symbol-description@^1.1.0: es-errors "^1.3.0" get-intrinsic "^1.2.6" -glob-parent@^5.1.2, glob-parent@~5.1.2: +glob-parent@^5.1.2: version "5.1.2" resolved "https://registry.yarnpkg.com/glob-parent/-/glob-parent-5.1.2.tgz#869832c58034fe68a4093c17dc15e8340d8401c4" integrity sha512-AOIgSQCepiJYwP3ARnGx+5VnTu2HBYdzbGP45eLw1vr3zB3vZLeyed1sC9hnbcOc9/SrMyM5RPQrkGz4aS9Zow== @@ -8749,10 +8732,10 @@ he@^1.2.0: resolved "https://registry.yarnpkg.com/he/-/he-1.2.0.tgz#84ae65fa7eafb165fddb61566ae14baf05664f0f" integrity sha512-F/1DnUGPopORZi0ni+CvrCgHQ5FyEAHRLSApuYWMmrbSwoN2Mn/7k+Gl38gJnR7yyDZk6WLXwiGod1JOWNDKGw== -headers-polyfill@3.2.5: - version "3.2.5" - resolved "https://registry.yarnpkg.com/headers-polyfill/-/headers-polyfill-3.2.5.tgz#6e67d392c9d113d37448fe45014e0afdd168faed" - integrity sha512-tUCGvt191vNSQgttSyJoibR+VO+I6+iCHIUdhzEMJKE+EAL8BwCN7fUOZlY4ofOelNHsK+gEjxB/B+9N3EWtdA== +headers-polyfill@^4.0.2: + version "4.0.3" + resolved "https://registry.yarnpkg.com/headers-polyfill/-/headers-polyfill-4.0.3.tgz#922a0155de30ecc1f785bcf04be77844ca95ad07" + integrity sha512-IScLbePpkvO846sIwOtOTDjutRMWdXdJmXdMvk6gCBHxFO8d+QKOQedyZSxFTTFYRSmlgSTDtXqqq4pcenBXLQ== history@^4.9.0: version "4.10.1" @@ -8957,13 +8940,6 @@ iconv-lite@0.6, iconv-lite@0.6.3, iconv-lite@^0.6.2: dependencies: safer-buffer ">= 2.1.2 < 3.0.0" -iconv-lite@^0.7.0: - version "0.7.0" - resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.7.0.tgz#c50cd80e6746ca8115eb98743afa81aa0e147a3e" - integrity sha512-cf6L2Ds3h57VVmkZe+Pn+5APsT7FpqJtEhhieDCvrE2MK5Qk9MyffgQyuxQTm6BChfeZNtcOLHp9IcWRVcIcBQ== - dependencies: - safer-buffer ">= 2.1.2 < 3.0.0" - icss-utils@^5.0.0, icss-utils@^5.1.0: version "5.1.0" resolved "https://registry.yarnpkg.com/icss-utils/-/icss-utils-5.1.0.tgz#c6be6858abd013d768e98366ae47e25d5887b1ae" @@ -9063,27 +9039,6 @@ inline-style-parser@0.1.1: resolved "https://registry.yarnpkg.com/inline-style-parser/-/inline-style-parser-0.1.1.tgz#ec8a3b429274e9c0a1f1c4ffa9453a7fef72cea1" integrity sha512-7NXolsK4CAS5+xvdj5OMMbI962hU/wvwoxk+LWR9Ek9bVtyuuYScDN6eS0rUm6TxApFpw7CX1o4uJzcd4AyD3Q== -inquirer@^8.2.0: - version "8.2.7" - resolved "https://registry.yarnpkg.com/inquirer/-/inquirer-8.2.7.tgz#62f6b931a9b7f8735dc42db927316d8fb6f71de8" - integrity sha512-UjOaSel/iddGZJ5xP/Eixh6dY1XghiBw4XK13rCCIJcJfyhhoul/7KhLLUGtebEj6GDYM6Vnx/mVsjx2L/mFIA== - dependencies: - "@inquirer/external-editor" "^1.0.0" - ansi-escapes "^4.2.1" - chalk "^4.1.1" - cli-cursor "^3.1.0" - cli-width "^3.0.0" - 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" - internal-slot@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/internal-slot/-/internal-slot-1.1.0.tgz#1eac91762947d2f7056bc838d93e13b2e9604961" @@ -9179,13 +9134,6 @@ is-bigint@^1.1.0: dependencies: has-bigints "^1.0.2" -is-binary-path@~2.1.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" - integrity sha512-ZMERYes6pDydyuGidse7OsHxtbI7WVeUEozgR/g7rd0xUimYNlvZRE/K2MgZTjWy725IfelLeVcEM97mmtRGXw== - dependencies: - binary-extensions "^2.0.0" - is-boolean-object@^1.2.1: version "1.2.2" resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.2.2.tgz#7067f47709809a393c71ff5bb3e135d8a9215d9e" @@ -9282,7 +9230,7 @@ is-generator-function@^1.0.10, is-generator-function@^1.0.7: has-tostringtag "^1.0.2" safe-regex-test "^1.1.0" -is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3, is-glob@~4.0.1: +is-glob@^4.0.0, is-glob@^4.0.1, is-glob@^4.0.3: version "4.0.3" resolved "https://registry.yarnpkg.com/is-glob/-/is-glob-4.0.3.tgz#64f61e42cbbb2eec2071a9dac0b28ba1e65d5084" integrity sha512-xelSayHH36ZgE7ZWhli7pW34hNbNl8Ojv5KVmkJD4hBdD3th8Tfk9vYasLM+mXWOZhFkgZfxhLSnrwRr4elSSg== @@ -10010,11 +9958,6 @@ jest@^29.7.0: import-local "^3.0.2" jest-cli "^29.7.0" -js-levenshtein@^1.1.6: - version "1.1.6" - resolved "https://registry.yarnpkg.com/js-levenshtein/-/js-levenshtein-1.1.6.tgz#c6cee58eb3550372df8deb85fad5ce66ce01d59d" - integrity sha512-X2BB11YZtrRqY4EnQcLX5Rh373zbK4alC1FW7D7MBhL2gtcC17cTnr6DmfHZeS0s2rTHjUTMMHfG7gO8SSdw+g== - "js-tokens@^3.0.0 || ^4.0.0", js-tokens@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz#19203fb59991df98e3a287050d4647cdeaf32499" @@ -11375,35 +11318,34 @@ msgpackr@^1.10.1: optionalDependencies: msgpackr-extract "^3.0.2" -msw@^1.3.4: - version "1.3.5" - resolved "https://registry.yarnpkg.com/msw/-/msw-1.3.5.tgz#708396f33a751d690eb8ee1d08713f5e9a77f27c" - integrity sha512-nG3fpmBXxFbKSIdk6miPuL3KjU6WMxgoW4tG1YgnP1M+TRG3Qn7b7R0euKAHq4vpwARHb18ZyfZljSxsTnMX2w== +msw@^2.11.5: + version "2.11.5" + resolved "https://registry.yarnpkg.com/msw/-/msw-2.11.5.tgz#69572ab70a60b5d72c8b6aed344595a7604241c0" + integrity sha512-atFI4GjKSJComxcigz273honh8h4j5zzpk5kwG4tGm0TPcYne6bqmVrufeRll6auBeouIkXqZYXxVbWSWxM3RA== 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" + "@inquirer/confirm" "^5.0.0" + "@mswjs/interceptors" "^0.39.1" + "@open-draft/deferred-promise" "^2.2.0" + "@types/statuses" "^2.0.4" + cookie "^1.0.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.3" path-to-regexp "^6.3.0" - strict-event-emitter "^0.4.3" - type-fest "^2.19.0" - yargs "^17.3.1" + picocolors "^1.1.1" + rettime "^0.7.0" + statuses "^2.0.2" + strict-event-emitter "^0.5.1" + tough-cookie "^6.0.0" + type-fest "^4.26.1" + until-async "^3.0.2" + yargs "^17.7.2" -mute-stream@0.0.8: - version "0.0.8" - resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" - integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== +mute-stream@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-2.0.0.tgz#a5446fc0c512b71c83c44d908d5c7b7b4c493b2b" + integrity sha512-WWdIxpyjEn+FhQJQQv9aQAYlHoNVdzIzUySNV1gHUPDSdZJ3yZn7pAAbQcV7B56Mvu881q9FZV+0Vx2xC44VWA== nanoid@^3.3.11: version "3.3.11" @@ -11466,7 +11408,7 @@ node-emoji@^1.10.0: dependencies: lodash "^4.17.21" -node-fetch@^2.6.7, node-fetch@^2.6.9: +node-fetch@^2.6.9: version "2.7.0" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d" integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A== @@ -11521,7 +11463,7 @@ normalize-package-data@^2.0.0, normalize-package-data@^2.5.0: semver "2 || 3 || 4 || 5" validate-npm-package-license "^3.0.1" -normalize-path@^3.0.0, normalize-path@~3.0.0: +normalize-path@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/normalize-path/-/normalize-path-3.0.0.tgz#0dcd69ff23a1c9b11fd0978316644a0388216a65" integrity sha512-6eZs5Ls3WtCisHWp9S2GUy8dqkpGi4BVSz3GaqiE6ezub0512ESztXUwUB6C6IKbQkY2Pnb/mD4WYojCRwcwLA== @@ -11694,7 +11636,7 @@ optionator@^0.9.3: type-check "^0.4.0" word-wrap "^1.2.5" -ora@^5.1.0, ora@^5.4.1: +ora@^5.1.0: version "5.4.1" resolved "https://registry.yarnpkg.com/ora/-/ora-5.4.1.tgz#1b2678426af4ac4a509008e5e4ac9e9959db9e18" integrity sha512-5b6Y85tPxZZ7QytO+BQzysW31HJku27cRIlkbAXaNx+BdcVi+LlRFmVXzeF6a7JCwJpyw5c4b+YSVImQIrBpuQ== @@ -11727,7 +11669,7 @@ osenv@^0.1.4: os-homedir "^1.0.0" os-tmpdir "^1.0.0" -outvariant@^1.2.1, outvariant@^1.4.0: +outvariant@^1.4.0, outvariant@^1.4.3: version "1.4.3" resolved "https://registry.yarnpkg.com/outvariant/-/outvariant-1.4.3.tgz#221c1bfc093e8fec7075497e7799fdbf43d14873" integrity sha512-+Sl2UErvtsoajRDKCE5/dBz4DIvHXQQnAxtQTF04OJxY0+DyZXSo5P5Bb7XYWOh81syohlYL24hbDwxedPUJCA== @@ -12004,7 +11946,7 @@ picocolors@^1.0.0, picocolors@^1.1.1: resolved "https://registry.yarnpkg.com/picocolors/-/picocolors-1.1.1.tgz#3d321af3eab939b083c8f929a1d12cda81c26b6b" integrity sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA== -picomatch@^2.0.4, picomatch@^2.2.1, picomatch@^2.2.3, picomatch@^2.3.1: +picomatch@^2.0.4, picomatch@^2.2.3, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== @@ -13012,13 +12954,6 @@ readdir-scoped-modules@^1.0.0: graceful-fs "^4.1.2" once "^1.3.0" -readdirp@~3.6.0: - version "3.6.0" - resolved "https://registry.yarnpkg.com/readdirp/-/readdirp-3.6.0.tgz#74a370bd857116e245b29cc97340cd431a02a6c7" - integrity sha512-hOS089on8RduqdbhvQ5Z37A0ESjsqz6qnRcffsMU3495FuTdqSm+7bhJ29JvIOsBDEEnan5DPu9t3To9VRlMzA== - dependencies: - picomatch "^2.2.1" - readline-sync@^1.4.9: version "1.4.10" resolved "https://registry.yarnpkg.com/readline-sync/-/readline-sync-1.4.10.tgz#41df7fbb4b6312d673011594145705bf56d8873b" @@ -13376,6 +13311,11 @@ retry@^0.12.0: resolved "https://registry.yarnpkg.com/retry/-/retry-0.12.0.tgz#1b42a6266a21f07421d1b0b54b7dc167b01c013b" integrity sha512-9LkiTwjUh6rT555DtE9rTX+BKByPfrMzEAtnlEtdEwr3Nkffwiihqe2bWADg+OQRjt9gl6ICdmB/ZFDCGAtSow== +rettime@^0.7.0: + version "0.7.0" + resolved "https://registry.yarnpkg.com/rettime/-/rettime-0.7.0.tgz#c040f1a65e396eaa4b8346dd96ed937edc79d96f" + integrity sha512-LPRKoHnLKd/r3dVxcwO7vhCW+orkOGj9ViueosEBK6ie89CijnfRlhaDhHq/3Hxu4CkWQtxwlBG0mzTQY6uQjw== + reusify@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/reusify/-/reusify-1.0.4.tgz#90da382b1e126efc02146e90845a88db12925d76" @@ -13458,11 +13398,6 @@ rollup@^4.20.0: "@rollup/rollup-win32-x64-msvc" "4.52.2" fsevents "~2.3.2" -run-async@^2.4.0: - version "2.4.1" - resolved "https://registry.yarnpkg.com/run-async/-/run-async-2.4.1.tgz#8440eccf99ea3e70bd409d49aab88e10c189a455" - integrity sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ== - run-parallel@^1.1.9: version "1.2.0" resolved "https://registry.yarnpkg.com/run-parallel/-/run-parallel-1.2.0.tgz#66d1368da7bdf921eb9d95bd1a9229e7f21a43ee" @@ -13475,7 +13410,7 @@ rw@1: resolved "https://registry.yarnpkg.com/rw/-/rw-1.3.3.tgz#3f862dfa91ab766b14885ef4d01124bfda074fb4" integrity sha512-PdhdWy89SiZogBLaw42zdeqtRJ//zFd2PgQavcICDUgJT5oW10QCRKbJ6bg4r0/UY2M6BWd5tkxuGFRvCkgfHQ== -rxjs@^7.4.0, rxjs@^7.5.1, rxjs@^7.5.5, rxjs@^7.8.1: +rxjs@^7.4.0, rxjs@^7.5.1, rxjs@^7.8.1: version "7.8.2" resolved "https://registry.yarnpkg.com/rxjs/-/rxjs-7.8.2.tgz#955bc473ed8af11a002a2be52071bf475638607b" integrity sha512-dhKf903U/PQZY6boNNtAGdWbG85WAbjT/1xYoZIC7FAY0yWapOBQVsVrDl58W86//e1VpMNBtRV4MaXfdMySFA== @@ -13739,11 +13674,6 @@ serialize-javascript@^6.0.2: dependencies: randombytes "^2.1.0" -set-cookie-parser@^2.4.6: - version "2.7.1" - resolved "https://registry.yarnpkg.com/set-cookie-parser/-/set-cookie-parser-2.7.1.tgz#3016f150072202dfbe90fadee053573cc89d2943" - integrity sha512-IOc8uWeOZgnb3ptbCURJWNjWUPcO3ZnTTdzsurqERrP6nPyv+paC55vJM0LpOlT2ne+Ix+9+CRG1MNLlyZ4GjQ== - set-function-length@^1.2.2: version "1.2.2" resolved "https://registry.yarnpkg.com/set-function-length/-/set-function-length-1.2.2.tgz#aac72314198eaed975cf77b2c3b6b880695e5449" @@ -13854,7 +13784,7 @@ signal-exit@^3.0.2, signal-exit@^3.0.3, signal-exit@^3.0.7: resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.7.tgz#a9a1767f8af84155114eaabd73f99273c8f59ad9" integrity sha512-wnD2ZE+l+SPC/uoS0vXeE9L1+0wuaMqKlfz9AMUo38JsyLSBWSFcHR1Rri62LZc12vLr1gb3jl7iwQhgwpAbGQ== -signal-exit@^4.0.1: +signal-exit@^4.0.1, signal-exit@^4.1.0: version "4.1.0" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-4.1.0.tgz#952188c1cbd546070e2dd20d0f41c0ae0530cb04" integrity sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw== @@ -14128,6 +14058,11 @@ static-eval@2.0.2: dependencies: escodegen "^1.8.1" +statuses@^2.0.2: + version "2.0.2" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.2.tgz#8f75eecef765b5e1cfcdc080da59409ed424e382" + integrity sha512-DvEy55V3DB7uknRo+4iOGT5fP1slR8wQohVdknigZPMpMstaKJQWhwiYBACJE3Ul2pTnATihhBYnRhZQHGBiRw== + stop-iteration-iterator@^1.0.0, stop-iteration-iterator@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/stop-iteration-iterator/-/stop-iteration-iterator-1.1.0.tgz#f481ff70a548f6124d0312c3aa14cbfa7aa542ad" @@ -14169,17 +14104,10 @@ streamx@^2.15.0: optionalDependencies: bare-events "^2.2.0" -strict-event-emitter@^0.2.4: - version "0.2.8" - resolved "https://registry.yarnpkg.com/strict-event-emitter/-/strict-event-emitter-0.2.8.tgz#b4e768927c67273c14c13d20e19d5e6c934b47ca" - integrity sha512-KDf/ujU8Zud3YaLtMCcTI4xkZlZVIYxTLr+XIULexP+77EEVWixeXroLUXQXiVtH4XH2W7jr/3PT1v3zBuvc3A== - dependencies: - events "^3.3.0" - -strict-event-emitter@^0.4.3: - version "0.4.6" - resolved "https://registry.yarnpkg.com/strict-event-emitter/-/strict-event-emitter-0.4.6.tgz#ff347c8162b3e931e3ff5f02cfce6772c3b07eb3" - integrity sha512-12KWeb+wixJohmnwNFerbyiBrAlq5qJLwIt38etRtKtmmHyDSoGlIqFE9wx+4IwG0aDjI7GV8tc8ZccjWZZtTg== +strict-event-emitter@^0.5.1: + version "0.5.1" + resolved "https://registry.yarnpkg.com/strict-event-emitter/-/strict-event-emitter-0.5.1.tgz#1602ece81c51574ca39c6815e09f1a3e8550bd93" + integrity sha512-vMgjE/GGEPEFnhFub6pa4FmJBRBVOLpIII2hvCZ8Kzb7K0hlHo7mQv6xYrBvCL2LtAIBwFUK8wvuJgTVSQ5MFQ== string-argv@0.3.1: version "0.3.1" @@ -14626,7 +14554,7 @@ through2@^2.0.1, through2@^2.0.3: readable-stream "~2.3.6" xtend "~4.0.1" -through@^2.3.6, through@^2.3.8: +through@^2.3.8: version "2.3.8" resolved "https://registry.yarnpkg.com/through/-/through-2.3.8.tgz#0dd4c9ffaabc357960b1b724115d7e0e86a2e1f5" integrity sha512-w89qg7PI8wAdvX60bMDP+bFoD5Dvhm9oLheFp5O4a2QF0cSBGsBX4qZmadPMvVqlLJBBci+WqGGOAPvcDeNSVg== @@ -14663,6 +14591,18 @@ tinyspy@^4.0.3: resolved "https://registry.yarnpkg.com/tinyspy/-/tinyspy-4.0.4.tgz#d77a002fb53a88aa1429b419c1c92492e0c81f78" integrity sha512-azl+t0z7pw/z958Gy9svOTuzqIk6xq+NSheJzn5MMWtWTFywIacg2wUlzKFGtt3cthx0r2SxMK0yzJOR0IES7Q== +tldts-core@^7.0.17: + version "7.0.17" + resolved "https://registry.yarnpkg.com/tldts-core/-/tldts-core-7.0.17.tgz#dadfee3750dd272ed219d7367beb7cbb2ff29eb8" + integrity sha512-DieYoGrP78PWKsrXr8MZwtQ7GLCUeLxihtjC1jZsW1DnvSMdKPitJSe8OSYDM2u5H6g3kWJZpePqkp43TfLh0g== + +tldts@^7.0.5: + version "7.0.17" + resolved "https://registry.yarnpkg.com/tldts/-/tldts-7.0.17.tgz#a6cdc067b9e80ea05f3be471c0ea410688cc78b2" + integrity sha512-Y1KQBgDd/NUc+LfOtKS6mNsC9CCaH+m2P1RoIZy7RAPo3C3/t8X45+zgut31cRZtZ3xKPjfn3TkGTrctC2TQIQ== + dependencies: + tldts-core "^7.0.17" + tmp-promise@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/tmp-promise/-/tmp-promise-3.0.3.tgz#60a1a1cc98c988674fcbfd23b6e3367bdeac4ce7" @@ -14709,6 +14649,13 @@ tough-cookie@^4.1.2: universalify "^0.2.0" url-parse "^1.5.3" +tough-cookie@^6.0.0: + version "6.0.0" + resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-6.0.0.tgz#11e418b7864a2c0d874702bc8ce0f011261940e5" + integrity sha512-kXuRi1mtaKMrsLUxz3sQYvVl37B0Ns6MzfrtV5DvJceE9bPyspOqk9xxv7XbZWcfLWbFmm997vl83qUWVJA64w== + dependencies: + tldts "^7.0.5" + tr46@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/tr46/-/tr46-3.0.0.tgz#555c4e297a950617e8eeddef633c87d4d9d6cbf9" @@ -14917,7 +14864,7 @@ type-fest@^0.8.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-0.8.1.tgz#09e249ebde851d3b1e48d27c105444667f17b83d" integrity sha512-4dbzIzqvjtgiM5rw1k5rEHtBANKmdudhGyBEajN01fEyhaAIhsoKNy6y7+IN93IfpFtwY9iqi7kD+xwKhQsNJA== -type-fest@^2.17.0, type-fest@^2.19.0: +type-fest@^2.17.0: version "2.19.0" resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-2.19.0.tgz#88068015bb33036a598b952e55e9311a60fd3a9b" integrity sha512-RAH822pAdBgcNMAfWnCBU3CFZcfZ/i1eZjwFU/dsLKumyuuP3niueg2UAukXYF0E2AAoc82ZSSf9J0WQBinzHA== @@ -14927,6 +14874,11 @@ type-fest@^3.13.1: resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-3.13.1.tgz#bb744c1f0678bea7543a2d1ec24e83e68e8c8706" integrity sha512-tLq3bSNx+xSpwvAJnzrK0Ep5CLNWjvFTOp71URMaAEWBfRb9nnJiBoUe0tF8bI4ZFO3omgBR6NvnbzVUT3Ly4g== +type-fest@^4.26.1: + version "4.41.0" + resolved "https://registry.yarnpkg.com/type-fest/-/type-fest-4.41.0.tgz#6ae1c8e5731273c2bf1f58ad39cbae2c91a46c58" + integrity sha512-TeTSQ6H5YHvpqVwBRcnLDCBnDOHWYu7IvGbHT6N8AOymcr9PJGjc1GTtiWZTYg0NCgYwvnYWEkVChQAr9bjfwA== + typed-array-buffer@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/typed-array-buffer/-/typed-array-buffer-1.0.3.tgz#a72395450a4869ec033fd549371b47af3a2ee536" @@ -14977,7 +14929,7 @@ typescript@5.6.2: resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.2.tgz#d1de67b6bef77c41823f822df8f0b3bcff60a5a0" integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw== -typescript@^4.0.5: +typescript@^4.9.5: version "4.9.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== @@ -15223,6 +15175,11 @@ unplugin@^1.3.1: acorn "^8.14.0" webpack-virtual-modules "^0.6.2" +until-async@^3.0.2: + version "3.0.2" + resolved "https://registry.yarnpkg.com/until-async/-/until-async-3.0.2.tgz#447f1531fdd7bb2b4c7a98869bdb1a4c2a23865f" + integrity sha512-IiSk4HlzAMqTUseHHe3VhIGyuFmN90zMTpD3Z3y8jeQbzLIq500MVM7Jq2vUAnTKAFPJrqwkzr6PoTcPhGcOiw== + untildify@^4.0.0: version "4.0.0" resolved "https://registry.yarnpkg.com/untildify/-/untildify-4.0.0.tgz#2bc947b953652487e4600949fb091e3ae8cd919b" @@ -15317,7 +15274,7 @@ util-extend@^1.0.1: resolved "https://registry.yarnpkg.com/util-extend/-/util-extend-1.0.3.tgz#a7c216d267545169637b3b6edc6ca9119e2ff93f" integrity sha512-mLs5zAK+ctllYBj+iAQvlDCwoxU/WDOUaJkcFudeiAX6OajC6BKXJUa9a+tbtkC11dz2Ufb7h0lyvIOVn4LADA== -util@^0.12.3, util@^0.12.5: +util@^0.12.5: version "0.12.5" resolved "https://registry.yarnpkg.com/util/-/util-0.12.5.tgz#5f17a6059b73db61a875668781a1c2b136bd6fbc" integrity sha512-kZf/K6hEIrWHI6XqOFUiiMa+79wE/D8Q+NCNAWclkyg3b4d2k7s0QGepNjiABc+aR3N1PAyHL7p6UcLY6LmrnA== @@ -15591,15 +15548,6 @@ wcwidth@^1.0.1: dependencies: defaults "^1.0.3" -web-encoding@^1.1.5: - version "1.1.5" - resolved "https://registry.yarnpkg.com/web-encoding/-/web-encoding-1.1.5.tgz#fc810cf7667364a6335c939913f5051d3e0c4864" - integrity sha512-HYLeVCdJ0+lBYV2FvNZmv3HJ2Nt0QYXqZojk3d9FJOLkwnuhzM9tmamh8d7HPM8QqjKH8DeHkFTx+CFlWpZZDA== - dependencies: - util "^0.12.3" - optionalDependencies: - "@zxing/text-encoding" "0.9.0" - web-namespaces@^1.0.0: version "1.1.4" resolved "https://registry.yarnpkg.com/web-namespaces/-/web-namespaces-1.1.4.tgz#bc98a3de60dadd7faefc403d1076d529f5e030ec" @@ -15819,7 +15767,7 @@ word-wrap@1.2.4, word-wrap@^1.2.5, word-wrap@~1.2.3: string-width "^4.1.0" strip-ansi "^6.0.0" -wrap-ansi@^6.0.1, wrap-ansi@^6.2.0: +wrap-ansi@^6.2.0: version "6.2.0" resolved "https://registry.yarnpkg.com/wrap-ansi/-/wrap-ansi-6.2.0.tgz#e9393ba07102e6c91a3b221478f0257cd2856e53" integrity sha512-r6lPcBGxZXlIcymEu7InxDMhdW0KDxpLgoFLcguasxCaJ/SOIZwINatK9KY/tf+ZrlywOKU0UDj3ATXUBfxJXA== @@ -15997,6 +15945,11 @@ yocto-queue@^1.0.0: resolved "https://registry.yarnpkg.com/yocto-queue/-/yocto-queue-1.2.1.tgz#36d7c4739f775b3cbc28e6136e21aa057adec418" integrity sha512-AyeEbWOu/TAXdxlV9wmGcR0+yh2j3vYPGOECcIj2S7MkrLyC7ne+oye2BKTItt0ii2PHk4cDy+95+LshzbXnGg== +yoctocolors-cjs@^2.1.2: + version "2.1.3" + resolved "https://registry.yarnpkg.com/yoctocolors-cjs/-/yoctocolors-cjs-2.1.3.tgz#7e4964ea8ec422b7a40ac917d3a344cfd2304baa" + integrity sha512-U/PBtDf35ff0D8X8D0jfdzHYEPFxAI7jJlxZXwCSez5M3190m+QobIfh+sWDWSHMCWWJN2AWamkegn6vr6YBTw== + zwitch@^1.0.0: version "1.0.5" resolved "https://registry.yarnpkg.com/zwitch/-/zwitch-1.0.5.tgz#d11d7381ffed16b742f6af7b3f223d5cd9fe9920" From 6f5d8e9b463d5dee856ca5e5a8bc9eaea4d5f32f Mon Sep 17 00:00:00 2001 From: pd-redis Date: Thu, 16 Oct 2025 17:12:27 +0300 Subject: [PATCH 02/19] update msw mocks --- .../analytics/clusterDetailsHandlers.ts | 11 ++-- .../analytics/dbAnalysisHistoryHandlers.ts | 11 ++-- .../ui/src/mocks/handlers/analytics/index.ts | 7 +-- .../src/mocks/handlers/app/featureHandlers.ts | 11 ++-- .../ui/src/mocks/handlers/app/index.ts | 8 +-- .../ui/src/mocks/handlers/app/infoHandlers.ts | 11 ++-- .../mocks/handlers/app/telemetryHandlers.ts | 18 +++---- .../handlers/browser/bulkActionsHandlers.ts | 11 ++-- .../ui/src/mocks/handlers/browser/index.ts | 7 +-- .../handlers/browser/redisearchHandlers.ts | 24 +++++---- .../content/createRedisButtonsHandlers.ts | 19 +++---- .../ui/src/mocks/handlers/content/index.ts | 5 +- redisinsight/ui/src/mocks/handlers/index.ts | 27 +++++----- .../handlers/instances/caCertsHandlers.ts | 23 +++++---- .../ui/src/mocks/handlers/instances/index.ts | 7 +-- .../handlers/instances/instancesHandlers.ts | 25 ++++++---- .../ui/src/mocks/handlers/oauth/cloud.ts | 16 +++--- .../ui/src/mocks/handlers/oauth/index.ts | 4 +- .../ui/src/mocks/handlers/rdi/index.ts | 7 +-- .../ui/src/mocks/handlers/rdi/rdiHandler.ts | 38 +++++++------- .../rdi/rdiPipelineStrategiesHandlers.ts | 11 ++-- .../mocks/handlers/recommendations/index.ts | 7 +-- .../recommendations/recommendationsHandler.ts | 17 ++++--- .../recommendationsReadHandler.ts | 13 ++--- .../ui/src/mocks/handlers/tutorials/index.ts | 6 +-- .../handlers/tutorials/tutorialsHandlers.ts | 16 +++--- .../ui/src/mocks/handlers/user/index.ts | 6 +-- .../handlers/user/userSettingsHandlers.ts | 10 ++-- .../src/mocks/handlers/workbench/commands.ts | 11 ++-- .../ui/src/mocks/handlers/workbench/index.ts | 6 +-- .../ui/src/mocks/res/responseComposition.ts | 8 +-- .../ui/src/services/executeQuery.spec.ts | 24 +++++---- .../ui/src/services/hooks/useLoadData.spec.ts | 50 ++++++++++--------- .../src/slices/tests/app/connectivity.spec.ts | 31 ++++++------ .../ui/src/slices/tests/app/init.spec.ts | 21 +++++--- 35 files changed, 268 insertions(+), 259 deletions(-) diff --git a/redisinsight/ui/src/mocks/handlers/analytics/clusterDetailsHandlers.ts b/redisinsight/ui/src/mocks/handlers/analytics/clusterDetailsHandlers.ts index b4c71937cb..e59b9582f9 100644 --- a/redisinsight/ui/src/mocks/handlers/analytics/clusterDetailsHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/analytics/clusterDetailsHandlers.ts @@ -1,4 +1,4 @@ -import { rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { ApiEndpoints } from 'uiSrc/constants' import { getUrl } from 'uiSrc/utils' import { getMswURL } from 'uiSrc/utils/test-utils' @@ -11,12 +11,13 @@ import { Database as DatabaseInstanceResponse } from 'apiSrc/modules/database/mo export const INSTANCE_ID_MOCK = 'instanceId' -const handlers: RestHandler[] = [ +const handlers: HttpHandler[] = [ // useGetClusterDetailsQuery - rest.get( + http.get( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.CLUSTER_DETAILS)), - async (_req, res, ctx) => - res(ctx.status(200), ctx.json(CLUSTER_DETAILS_DATA_MOCK)), + async () => { + HttpResponse.json(CLUSTER_DETAILS_DATA_MOCK, { status: 200 }) + }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/analytics/dbAnalysisHistoryHandlers.ts b/redisinsight/ui/src/mocks/handlers/analytics/dbAnalysisHistoryHandlers.ts index c20f63f3d5..a757ba3da9 100644 --- a/redisinsight/ui/src/mocks/handlers/analytics/dbAnalysisHistoryHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/analytics/dbAnalysisHistoryHandlers.ts @@ -1,16 +1,17 @@ -import { rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { ApiEndpoints } from 'uiSrc/constants' import { getUrl } from 'uiSrc/utils' import { getMswURL } from 'uiSrc/utils/test-utils' export const INSTANCE_ID_MOCK = 'instanceId' -const handlers: RestHandler[] = [ +const handlers: HttpHandler[] = [ // fetchDBAnalysisReportsHistory - rest.get( + http.get( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.DATABASE_ANALYSIS)), - async (_req, res, ctx) => - res(ctx.status(200), ctx.json(DB_ANALYSIS_HISTORY_DATA_MOCK)), + async () => { + HttpResponse.json(DB_ANALYSIS_HISTORY_DATA_MOCK, { status: 200 }) + }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/analytics/index.ts b/redisinsight/ui/src/mocks/handlers/analytics/index.ts index b01bff277b..bfc42dc65f 100644 --- a/redisinsight/ui/src/mocks/handlers/analytics/index.ts +++ b/redisinsight/ui/src/mocks/handlers/analytics/index.ts @@ -1,10 +1,7 @@ -import { DefaultBodyType, MockedRequest, RestHandler } from 'msw' +import { HttpHandler } from 'msw' import clusterDetails from './clusterDetailsHandlers' import dbAnalysisHistory from './dbAnalysisHistoryHandlers' -const handlers: RestHandler>[] = [].concat( - clusterDetails, - dbAnalysisHistory, -) +const handlers: HttpHandler[] = [...clusterDetails, ...dbAnalysisHistory] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/app/featureHandlers.ts b/redisinsight/ui/src/mocks/handlers/app/featureHandlers.ts index b4a791a953..7c3606ea3e 100644 --- a/redisinsight/ui/src/mocks/handlers/app/featureHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/app/featureHandlers.ts @@ -1,4 +1,4 @@ -import { rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { ApiEndpoints } from 'uiSrc/constants' import { getMswURL } from 'uiSrc/utils/test-utils' @@ -92,12 +92,13 @@ export const FEATURES_DATA_MOCK = { }, } -const handlers: RestHandler[] = [ +const handlers: HttpHandler[] = [ // get features - rest.get<(typeof FEATURES_DATA_MOCK)[]>( + http.get( getMswURL(ApiEndpoints.FEATURES), - async (_req, res, ctx) => - res(ctx.status(200), ctx.json(FEATURES_DATA_MOCK)), + async () => { + HttpResponse.json(FEATURES_DATA_MOCK, { status: 200 }) + }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/app/index.ts b/redisinsight/ui/src/mocks/handlers/app/index.ts index 3378c6eae4..7751df87df 100644 --- a/redisinsight/ui/src/mocks/handlers/app/index.ts +++ b/redisinsight/ui/src/mocks/handlers/app/index.ts @@ -1,12 +1,8 @@ -import { DefaultBodyType, MockedRequest, RestHandler } from 'msw' +import { HttpHandler } from 'msw' import info from './infoHandlers' import telemetry from './telemetryHandlers' import featureHandlers from './featureHandlers' -const handlers: RestHandler>[] = [].concat( - info, - telemetry, - featureHandlers, -) +const handlers: HttpHandler[] = [...info, ...telemetry, ...featureHandlers] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/app/infoHandlers.ts b/redisinsight/ui/src/mocks/handlers/app/infoHandlers.ts index cdea01f50f..8ea801047d 100644 --- a/redisinsight/ui/src/mocks/handlers/app/infoHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/app/infoHandlers.ts @@ -1,4 +1,4 @@ -import { rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { ApiEndpoints } from 'uiSrc/constants' import { getMswURL } from 'uiSrc/utils/test-utils' import { Database as DatabaseInstanceResponse } from 'apiSrc/modules/database/models/database' @@ -11,12 +11,13 @@ export const APP_INFO_DATA_MOCK = { buildType: 'ELECTRON', } -const handlers: RestHandler[] = [ +const handlers: HttpHandler[] = [ // fetchServerInfo - rest.get( + http.get( getMswURL(ApiEndpoints.INFO), - async (_req, res, ctx) => - res(ctx.status(200), ctx.json(APP_INFO_DATA_MOCK)), + async () => { + HttpResponse.json(APP_INFO_DATA_MOCK, { status: 200 }) + }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/app/telemetryHandlers.ts b/redisinsight/ui/src/mocks/handlers/app/telemetryHandlers.ts index c2cc153724..1bb96380ab 100644 --- a/redisinsight/ui/src/mocks/handlers/app/telemetryHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/app/telemetryHandlers.ts @@ -1,18 +1,16 @@ -import { rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { ApiEndpoints } from 'uiSrc/constants' import { getMswURL } from 'uiSrc/utils/test-utils' -const handlers: RestHandler[] = [ +const handlers: HttpHandler[] = [ // sendEventTelemetry - rest.post( - getMswURL(ApiEndpoints.ANALYTICS_SEND_EVENT), - async (req, res, ctx) => res(ctx.status(200)), - ), + http.post(getMswURL(ApiEndpoints.ANALYTICS_SEND_EVENT), async () => { + HttpResponse.text('', { status: 200 }) + }), // sendPageViewTelemetry - rest.post( - getMswURL(ApiEndpoints.ANALYTICS_SEND_PAGE), - async (req, res, ctx) => res(ctx.status(200)), - ), + http.post(getMswURL(ApiEndpoints.ANALYTICS_SEND_PAGE), async () => { + HttpResponse.text('', { status: 200 }) + }), ] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/browser/bulkActionsHandlers.ts b/redisinsight/ui/src/mocks/handlers/browser/bulkActionsHandlers.ts index 5ea28a186e..e373b0753a 100644 --- a/redisinsight/ui/src/mocks/handlers/browser/bulkActionsHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/browser/bulkActionsHandlers.ts @@ -1,4 +1,4 @@ -import { rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { ApiEndpoints } from 'uiSrc/constants' import { getMswURL } from 'uiSrc/utils/test-utils' import { getUrl } from 'uiSrc/utils' @@ -6,16 +6,17 @@ import { IBulkActionOverview } from 'uiSrc/slices/interfaces' import { bulkActionOverviewFactory } from 'uiSrc/mocks/factories/browser/bulkActions/bulkActionOverview.factory' import { INSTANCE_ID_MOCK } from '../instances/instancesHandlers' -const handlers: RestHandler[] = [ - rest.post( +const handlers: HttpHandler[] = [ + http.post( getMswURL( getUrl( INSTANCE_ID_MOCK, ApiEndpoints.BULK_ACTIONS_IMPORT_VECTOR_COLLECTION, ), ), - async (_req, res, ctx) => - res(ctx.status(200), ctx.json(bulkActionOverviewFactory.build())), + async () => { + HttpResponse.json(bulkActionOverviewFactory.build(), { status: 200 }) + }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/browser/index.ts b/redisinsight/ui/src/mocks/handlers/browser/index.ts index 2635a980be..3f8ba9c2a9 100644 --- a/redisinsight/ui/src/mocks/handlers/browser/index.ts +++ b/redisinsight/ui/src/mocks/handlers/browser/index.ts @@ -1,10 +1,7 @@ -import { DefaultBodyType, MockedRequest, RestHandler } from 'msw' +import { HttpHandler } from 'msw' import redisearch from './redisearchHandlers' import bulkActions from './bulkActionsHandlers' -const handlers: RestHandler>[] = [].concat( - redisearch, - bulkActions, -) +const handlers: HttpHandler[] = [...redisearch, ...bulkActions] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/browser/redisearchHandlers.ts b/redisinsight/ui/src/mocks/handlers/browser/redisearchHandlers.ts index de3b7e1c61..555a54fbe0 100644 --- a/redisinsight/ui/src/mocks/handlers/browser/redisearchHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/browser/redisearchHandlers.ts @@ -1,4 +1,4 @@ -import { rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { ApiEndpoints } from 'uiSrc/constants' import { getMswURL } from 'uiSrc/utils/test-utils' import { getUrl, stringToBuffer } from 'uiSrc/utils' @@ -16,21 +16,25 @@ export const REDISEARCH_LIST_DATA_MOCK = { ), } -const handlers: RestHandler[] = [ +const handlers: HttpHandler[] = [ // fetchRedisearchListAction - rest.get( + http.get( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.REDISEARCH)), - async (_req, res, ctx) => - res(ctx.status(200), ctx.json(REDISEARCH_LIST_DATA_MOCK)), + async () => { + HttpResponse.json(REDISEARCH_LIST_DATA_MOCK, { status: 200 }) + }, ), - rest.post( + http.post( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.REDISEARCH_INFO)), - async (_req, res, ctx) => - res(ctx.status(200), ctx.json(indexInfoFactory.build())), + async () => { + HttpResponse.json(indexInfoFactory.build(), { status: 200 }) + }, ), - rest.delete( + http.delete( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.REDISEARCH)), - async (_req, res, ctx) => res(ctx.status(204)), + async () => { + HttpResponse.text('', { status: 204 }) + }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/content/createRedisButtonsHandlers.ts b/redisinsight/ui/src/mocks/handlers/content/createRedisButtonsHandlers.ts index eea21c89a0..bc7a8ce1ed 100644 --- a/redisinsight/ui/src/mocks/handlers/content/createRedisButtonsHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/content/createRedisButtonsHandlers.ts @@ -1,16 +1,15 @@ -import { rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { ApiEndpoints } from 'uiSrc/constants' import { ConnectionType } from 'uiSrc/slices/interfaces' import { getMswResourceURL } from 'uiSrc/utils/test-utils' -const handlers: RestHandler[] = [ +const handlers: HttpHandler[] = [ // fetchContentAction - rest.get( + http.get( getMswResourceURL(ApiEndpoints.CONTENT_CREATE_DATABASE), - async (req, res, ctx) => - res( - ctx.status(200), - ctx.json([ + async () => { + HttpResponse.json( + [ { id: 'e37cc441-a4f2-402c-8bdb-fc2413cbbaff', host: 'localhost', @@ -64,8 +63,10 @@ const handlers: RestHandler[] = [ name: 'mymaster', }, }, - ]), - ), + ], + { status: 200 }, + ) + }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/content/index.ts b/redisinsight/ui/src/mocks/handlers/content/index.ts index b7bfd09f30..e126f60d9e 100644 --- a/redisinsight/ui/src/mocks/handlers/content/index.ts +++ b/redisinsight/ui/src/mocks/handlers/content/index.ts @@ -1,6 +1,5 @@ -import { DefaultBodyType, MockedRequest, RestHandler } from 'msw' - +import { HttpHandler } from 'msw' import crb from './createRedisButtonsHandlers' -const handlers: RestHandler[] = [].concat(crb) +const handlers: HttpHandler[] = [...crb] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/index.ts b/redisinsight/ui/src/mocks/handlers/index.ts index b02d9fceb0..c4de8de4cb 100644 --- a/redisinsight/ui/src/mocks/handlers/index.ts +++ b/redisinsight/ui/src/mocks/handlers/index.ts @@ -1,4 +1,3 @@ -import { MockedRequest, RestHandler } from 'msw' import instances from './instances' import content from './content' import app from './app' @@ -12,16 +11,16 @@ import user from './user' import workbench from './workbench' // @ts-ignore -export const handlers: RestHandler[] = [].concat( - instances, - content, - app, - analytics, - browser, - recommendations, - cloud, - tutorials, - rdi, - user, - workbench, -) +export const handlers = [ + ...instances, + ...content, + ...app, + ...analytics, + ...browser, + ...recommendations, + ...cloud, + ...tutorials, + ...rdi, + ...user, + ...workbench, +] diff --git a/redisinsight/ui/src/mocks/handlers/instances/caCertsHandlers.ts b/redisinsight/ui/src/mocks/handlers/instances/caCertsHandlers.ts index da4632ff4c..8a90272971 100644 --- a/redisinsight/ui/src/mocks/handlers/instances/caCertsHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/instances/caCertsHandlers.ts @@ -1,20 +1,25 @@ -import { DefaultBodyType, MockedRequest, rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { ApiEndpoints } from 'uiSrc/constants' import { getMswURL } from 'uiSrc/utils/test-utils' -const handlers: RestHandler>[] = [ - rest.post(getMswURL(ApiEndpoints.CA_CERTIFICATES), (req, res, ctx) => { - const { username } = req.body +interface CaCertRequestBody { + username: string +} - return res( - ctx.json({ +const handlers: HttpHandler[] = [ + http.post( + getMswURL(ApiEndpoints.CA_CERTIFICATES), + async ({ request }) => { + const { username } = await request.clone().json() + + return HttpResponse.json({ id: 'f79e82e8-c34a-4dc7-a49e-9fadc0979fda', username, firstName: 'John', lastName: 'Maverick', - }), - ) - }), + }) + }, + ), ] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/instances/index.ts b/redisinsight/ui/src/mocks/handlers/instances/index.ts index ad522838c5..e396dbb47c 100644 --- a/redisinsight/ui/src/mocks/handlers/instances/index.ts +++ b/redisinsight/ui/src/mocks/handlers/instances/index.ts @@ -1,10 +1,7 @@ -import { DefaultBodyType, MockedRequest, RestHandler } from 'msw' +import { HttpHandler } from 'msw' import instances from './instancesHandlers' import caCerts from './caCertsHandlers' -const handlers: RestHandler>[] = [].concat( - instances, - caCerts, -) +const handlers: HttpHandler[] = [...instances, ...caCerts] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts b/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts index 4c2bb18dc4..3a10e0d0f3 100644 --- a/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts @@ -1,4 +1,4 @@ -import { rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { RedisNodeInfoResponse } from 'src/modules/database/dto/redis-info.dto' import { ApiEndpoints } from 'uiSrc/constants' import { ConnectionType, Instance } from 'uiSrc/slices/interfaces' @@ -76,25 +76,30 @@ export const getDatabasesApiSpy = jest res(ctx.status(200), ctx.json(INSTANCES_MOCK)), ) -const handlers: RestHandler[] = [ +const handlers: HttpHandler[] = [ // fetchInstancesAction - rest.get( + http.get( getMswURL(ApiEndpoints.DATABASES), getDatabasesApiSpy, ), - rest.post( + http.post( getMswURL(ApiEndpoints.DATABASES_EXPORT), - async (_req, res, ctx) => res(ctx.status(200), ctx.json(INSTANCES_MOCK)), + async () => { + HttpResponse.json(INSTANCES_MOCK, { status: 200 }) + }, ), - rest.get( + http.get( getMswURL(getUrl(INSTANCE_ID_MOCK)), - async (_req, res, ctx) => res(ctx.status(200), ctx.json(INSTANCES_MOCK[0])), + async () => { + HttpResponse.json(INSTANCES_MOCK[0], { status: 200 }) + }, ), - rest.get( + http.get( getMswURL(`/${ApiEndpoints.DATABASES}/:id/info`), // getMswURL(getUrl(INSTANCE_ID_MOCK, 'info')), - async (_req, res, ctx) => - res(ctx.status(200), ctx.json(MOCK_INFO_API_RESPONSE)), + async () => { + HttpResponse.json(MOCK_INFO_API_RESPONSE, { status: 200 }) + }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/oauth/cloud.ts b/redisinsight/ui/src/mocks/handlers/oauth/cloud.ts index 1f348910e0..796af6e89b 100644 --- a/redisinsight/ui/src/mocks/handlers/oauth/cloud.ts +++ b/redisinsight/ui/src/mocks/handlers/oauth/cloud.ts @@ -1,4 +1,4 @@ -import { rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { getMswURL } from 'uiSrc/utils/test-utils' import { ApiEndpoints } from 'uiSrc/constants' import { OAUTH_CLOUD_CAPI_KEYS_DATA } from 'uiSrc/mocks/data/oauth' @@ -16,16 +16,16 @@ export const CLOUD_ME_DATA_MOCK = { data: {}, } -const handlers: RestHandler[] = [ +const handlers: HttpHandler[] = [ // fetch cloud capi keys - rest.get(getMswURL(ApiEndpoints.CLOUD_CAPI_KEYS), async (_req, res, ctx) => - res(ctx.status(200), ctx.json(OAUTH_CLOUD_CAPI_KEYS_DATA)), - ), + http.get(getMswURL(ApiEndpoints.CLOUD_CAPI_KEYS), async () => { + HttpResponse.json(OAUTH_CLOUD_CAPI_KEYS_DATA, { status: 200 }) + }), // fetch user profile - rest.get(getMswURL(ApiEndpoints.CLOUD_ME), async (_req, res, ctx) => - res(ctx.status(200), ctx.json(CLOUD_ME_DATA_MOCK)), - ), + http.get(getMswURL(ApiEndpoints.CLOUD_ME), async () => { + HttpResponse.json(CLOUD_ME_DATA_MOCK, { status: 200 }) + }), ] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/oauth/index.ts b/redisinsight/ui/src/mocks/handlers/oauth/index.ts index 5f7f4b401f..28ed0859ec 100644 --- a/redisinsight/ui/src/mocks/handlers/oauth/index.ts +++ b/redisinsight/ui/src/mocks/handlers/oauth/index.ts @@ -1,6 +1,6 @@ -import { DefaultBodyType, MockedRequest, RestHandler } from 'msw' +import { HttpHandler } from 'msw' import cloud from './cloud' -const handlers: RestHandler>[] = [].concat(cloud) +const handlers: HttpHandler[] = [...cloud] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/rdi/index.ts b/redisinsight/ui/src/mocks/handlers/rdi/index.ts index 8307bf5c42..2d38ab7bd4 100644 --- a/redisinsight/ui/src/mocks/handlers/rdi/index.ts +++ b/redisinsight/ui/src/mocks/handlers/rdi/index.ts @@ -1,11 +1,8 @@ -import { DefaultBodyType, MockedRequest, RestHandler } from 'msw' +import { HttpHandler } from 'msw' import rdiHandler from './rdiHandler' import rdiStrategiesHandler from './rdiPipelineStrategiesHandlers' // @ts-ignore -const handlers: RestHandler>[] = [].concat( - rdiHandler, - rdiStrategiesHandler, -) +const handlers: HttpHandler[] = [...rdiHandler, ...rdiStrategiesHandler] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/rdi/rdiHandler.ts b/redisinsight/ui/src/mocks/handlers/rdi/rdiHandler.ts index 7be4f7c50e..3419214a7b 100644 --- a/redisinsight/ui/src/mocks/handlers/rdi/rdiHandler.ts +++ b/redisinsight/ui/src/mocks/handlers/rdi/rdiHandler.ts @@ -1,17 +1,16 @@ -import { rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { getMswURL } from 'uiSrc/utils/test-utils' import { getUrl } from 'uiSrc/utils' import { ApiEndpoints } from 'uiSrc/constants' import { Rdi as RdiInstanceResponse } from 'apiSrc/modules/rdi/models/rdi' -const handlers: RestHandler[] = [ +const handlers: HttpHandler[] = [ // fetch rdi instances - rest.get( + http.get( getMswURL(getUrl(ApiEndpoints.RDI_INSTANCES)), - async (_req, res, ctx) => - res( - ctx.status(200), - ctx.json([ + async () => { + HttpResponse.json( + [ { id: '1', name: 'My first integration', @@ -21,25 +20,26 @@ const handlers: RestHandler[] = [ type: 'api', username: 'user', }, - ]), - ), + ], + { status: 200 }, + ) + }, ), // create rdi instance - rest.post(getMswURL(ApiEndpoints.RDI_INSTANCES), async (_req, res, ctx) => - res(ctx.status(200), ctx.json({})), - ), + http.post(getMswURL(ApiEndpoints.RDI_INSTANCES), async () => { + HttpResponse.json({}, { status: 200 }) + }), // update rdi instance - rest.patch( - getMswURL(getUrl('1', ApiEndpoints.RDI_INSTANCES)), - async (_req, res, ctx) => res(ctx.status(200), ctx.json({})), - ), + http.patch(getMswURL(getUrl('1', ApiEndpoints.RDI_INSTANCES)), async () => { + HttpResponse.json({}, { status: 200 }) + }), // delete rdi instance - rest.delete(getMswURL(ApiEndpoints.RDI_INSTANCES), async (_req, res, ctx) => - res(ctx.status(200), ctx.json({})), - ), + http.delete(getMswURL(ApiEndpoints.RDI_INSTANCES), async () => { + HttpResponse.json({}, { status: 200 }) + }), ] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/rdi/rdiPipelineStrategiesHandlers.ts b/redisinsight/ui/src/mocks/handlers/rdi/rdiPipelineStrategiesHandlers.ts index bc27841b0b..e4b4b52207 100644 --- a/redisinsight/ui/src/mocks/handlers/rdi/rdiPipelineStrategiesHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/rdi/rdiPipelineStrategiesHandlers.ts @@ -1,4 +1,4 @@ -import { rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { getMswURL } from 'uiSrc/utils/test-utils' import { getRdiUrl } from 'uiSrc/utils' import { ApiEndpoints } from 'uiSrc/constants' @@ -38,12 +38,13 @@ const MOCK_RDI_STRATEGIES = { ], } -const handlers: RestHandler[] = [ +const handlers: HttpHandler[] = [ // fetch rdi strategies - rest.get( + http.get( getMswURL(getRdiUrl('rdiInstanceId', ApiEndpoints.RDI_PIPELINE_STRATEGIES)), - async (_req, res, ctx) => - res(ctx.status(200), ctx.json(MOCK_RDI_STRATEGIES)), + async () => { + HttpResponse.json(MOCK_RDI_STRATEGIES, { status: 200 }) + }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/recommendations/index.ts b/redisinsight/ui/src/mocks/handlers/recommendations/index.ts index a3b1be2c99..1db07d6605 100644 --- a/redisinsight/ui/src/mocks/handlers/recommendations/index.ts +++ b/redisinsight/ui/src/mocks/handlers/recommendations/index.ts @@ -1,10 +1,7 @@ -import { DefaultBodyType, MockedRequest, RestHandler } from 'msw' +import { HttpHandler } from 'msw' import recommendations from './recommendationsHandler' import readRecommendations from './recommendationsReadHandler' -const handlers: RestHandler>[] = [].concat( - recommendations, - readRecommendations, -) +const handlers: HttpHandler[] = [...recommendations, ...readRecommendations] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/recommendations/recommendationsHandler.ts b/redisinsight/ui/src/mocks/handlers/recommendations/recommendationsHandler.ts index 52840f5d28..1d8416c138 100644 --- a/redisinsight/ui/src/mocks/handlers/recommendations/recommendationsHandler.ts +++ b/redisinsight/ui/src/mocks/handlers/recommendations/recommendationsHandler.ts @@ -1,4 +1,4 @@ -import { rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { ApiEndpoints } from 'uiSrc/constants' import { getMswURL } from 'uiSrc/utils/test-utils' import { getUrl } from 'uiSrc/utils' @@ -13,16 +13,19 @@ export const RECOMMENDATIONS_DATA_MOCK = { totalUnread: 1, } -const handlers: RestHandler[] = [ +const handlers: HttpHandler[] = [ // fetchRecommendationsAction - rest.get( + http.get( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.RECOMMENDATIONS)), - async (req, res, ctx) => - res(ctx.status(200), ctx.json(RECOMMENDATIONS_DATA_MOCK)), + async () => { + HttpResponse.json(RECOMMENDATIONS_DATA_MOCK, { status: 200 }) + }, ), - rest.delete( + http.delete( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.RECOMMENDATIONS)), - async (req, res, ctx) => res(ctx.status(200)), + async () => { + HttpResponse.text({ status: 200 }) + }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/recommendations/recommendationsReadHandler.ts b/redisinsight/ui/src/mocks/handlers/recommendations/recommendationsReadHandler.ts index 199f2b8af4..f4a02ce21a 100644 --- a/redisinsight/ui/src/mocks/handlers/recommendations/recommendationsReadHandler.ts +++ b/redisinsight/ui/src/mocks/handlers/recommendations/recommendationsReadHandler.ts @@ -1,8 +1,8 @@ -import { rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { ApiEndpoints } from 'uiSrc/constants' import { getMswURL } from 'uiSrc/utils/test-utils' import { getUrl } from 'uiSrc/utils' -import { Recommendation as RecommendationResponse } from 'apiSrc/modules/database-recommendations/models/recommendation' +import { DatabaseRecommendation as RecommendationResponse } from 'apiSrc/modules/database-recommendation/models/database-recommendation' import { INSTANCE_ID_MOCK } from '../instances/instancesHandlers' const EMPTY_RECOMMENDATIONS_MOCK = { @@ -10,12 +10,13 @@ const EMPTY_RECOMMENDATIONS_MOCK = { totalUnread: 0, } -const handlers: RestHandler[] = [ +const handlers: HttpHandler[] = [ // readRecommendationsAction - rest.patch( + http.patch( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.RECOMMENDATIONS_READ)), - async (req, res, ctx) => - res(ctx.status(200), ctx.json(EMPTY_RECOMMENDATIONS_MOCK)), + async () => { + HttpResponse.json(EMPTY_RECOMMENDATIONS_MOCK, { status: 200 }) + }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/tutorials/index.ts b/redisinsight/ui/src/mocks/handlers/tutorials/index.ts index c4579ea423..459dc153ad 100644 --- a/redisinsight/ui/src/mocks/handlers/tutorials/index.ts +++ b/redisinsight/ui/src/mocks/handlers/tutorials/index.ts @@ -1,9 +1,7 @@ -import { DefaultBodyType, MockedRequest, RestHandler } from 'msw' +import { HttpHandler } from 'msw' import tutorials from './tutorialsHandlers' // @ts-ignore -const handlers: RestHandler>[] = [].concat( - tutorials, -) +const handlers: HttpHandler[] = [...tutorials] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/tutorials/tutorialsHandlers.ts b/redisinsight/ui/src/mocks/handlers/tutorials/tutorialsHandlers.ts index 1743552690..7da1715049 100644 --- a/redisinsight/ui/src/mocks/handlers/tutorials/tutorialsHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/tutorials/tutorialsHandlers.ts @@ -1,15 +1,13 @@ -import { DefaultBodyType, MockedRequest, rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { ApiEndpoints } from 'uiSrc/constants' import { getMswURL } from 'uiSrc/utils/test-utils' -const handlers: RestHandler>[] = [ - rest.post(getMswURL(ApiEndpoints.CUSTOM_TUTORIALS), (_, res, ctx) => - res( - ctx.json({ - id: 'f79e82e8-c34a-4dc7-a49e-9fadc0979fda', - }), - ), - ), +const handlers: HttpHandler[] = [ + http.post(getMswURL(ApiEndpoints.CUSTOM_TUTORIALS), () => { + HttpResponse.json({ + id: 'f79e82e8-c34a-4dc7-a49e-9fadc0979fda', + }) + }), ] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/user/index.ts b/redisinsight/ui/src/mocks/handlers/user/index.ts index 2a82a9fb3f..55004ce9b1 100644 --- a/redisinsight/ui/src/mocks/handlers/user/index.ts +++ b/redisinsight/ui/src/mocks/handlers/user/index.ts @@ -1,8 +1,6 @@ -import { DefaultBodyType, MockedRequest, RestHandler } from 'msw' +import { HttpHandler } from 'msw' import userSettings from './userSettingsHandlers' -const handlers: RestHandler>[] = [].concat( - userSettings, -) +const handlers: HttpHandler[] = [...userSettings] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/user/userSettingsHandlers.ts b/redisinsight/ui/src/mocks/handlers/user/userSettingsHandlers.ts index 9dc0bc3433..a0d655db75 100644 --- a/redisinsight/ui/src/mocks/handlers/user/userSettingsHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/user/userSettingsHandlers.ts @@ -1,4 +1,4 @@ -import { rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { ApiEndpoints } from 'uiSrc/constants' import { getMswURL } from 'uiSrc/utils/test-utils' @@ -16,10 +16,10 @@ export const USER_SETTINGS_DATA_MOCK = { }, } -const handlers: RestHandler[] = [ - rest.get(getMswURL(ApiEndpoints.SETTINGS), async (_req, res, ctx) => - res(ctx.status(200), ctx.json(USER_SETTINGS_DATA_MOCK)), - ), +const handlers: HttpHandler[] = [ + http.get(getMswURL(ApiEndpoints.SETTINGS), async () => { + HttpResponse.json(USER_SETTINGS_DATA_MOCK, { status: 200 }) + }), ] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/workbench/commands.ts b/redisinsight/ui/src/mocks/handlers/workbench/commands.ts index 2f197b93fa..c611a68058 100644 --- a/redisinsight/ui/src/mocks/handlers/workbench/commands.ts +++ b/redisinsight/ui/src/mocks/handlers/workbench/commands.ts @@ -1,4 +1,4 @@ -import { rest, RestHandler } from 'msw' +import { http, HttpHandler, HttpResponse } from 'msw' import { ApiEndpoints } from 'uiSrc/constants' import { getMswURL } from 'uiSrc/utils/test-utils' import { getUrl } from 'uiSrc/utils' @@ -6,13 +6,14 @@ import { CommandExecution } from 'uiSrc/slices/interfaces' import { commandExecutionFactory } from 'uiSrc/mocks/factories/workbench/commandExectution.factory' import { INSTANCE_ID_MOCK } from '../instances/instancesHandlers' -const handlers: RestHandler[] = [ - rest.post( +const handlers: HttpHandler[] = [ + http.post( getMswURL( getUrl(INSTANCE_ID_MOCK, ApiEndpoints.WORKBENCH_COMMAND_EXECUTIONS), ), - async (_req, res, ctx) => - res(ctx.status(200), ctx.json(commandExecutionFactory.buildList(1))), + async () => { + HttpResponse.json(commandExecutionFactory.buildList(1), { status: 200 }) + }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/workbench/index.ts b/redisinsight/ui/src/mocks/handlers/workbench/index.ts index 85701ab6a7..b55ba3bdf0 100644 --- a/redisinsight/ui/src/mocks/handlers/workbench/index.ts +++ b/redisinsight/ui/src/mocks/handlers/workbench/index.ts @@ -1,8 +1,6 @@ -import { DefaultBodyType, MockedRequest, RestHandler } from 'msw' +import { HttpHandler } from 'msw' import commands from './commands' -const handlers: RestHandler>[] = [].concat( - commands, -) +const handlers: HttpHandler[] = [...commands] export default handlers diff --git a/redisinsight/ui/src/mocks/res/responseComposition.ts b/redisinsight/ui/src/mocks/res/responseComposition.ts index 07d8ba08f8..1f29c011d1 100644 --- a/redisinsight/ui/src/mocks/res/responseComposition.ts +++ b/redisinsight/ui/src/mocks/res/responseComposition.ts @@ -1,8 +1,8 @@ -import { rest } from 'msw' +import { http, HttpResponse } from 'msw' import { DEFAULT_ERROR_MESSAGE } from 'uiSrc/utils' export const errorHandlers = [ - rest.all('*', (_req, res, ctx) => - res(ctx.status(500), ctx.json({ message: DEFAULT_ERROR_MESSAGE })), - ), + http.all('*', () => { + HttpResponse.json({ message: DEFAULT_ERROR_MESSAGE }, { status: 500 }) + }), ] diff --git a/redisinsight/ui/src/services/executeQuery.spec.ts b/redisinsight/ui/src/services/executeQuery.spec.ts index fa03231810..4fc2d0b8f5 100644 --- a/redisinsight/ui/src/services/executeQuery.spec.ts +++ b/redisinsight/ui/src/services/executeQuery.spec.ts @@ -1,9 +1,9 @@ -import { rest } from 'msw' +import { http, HttpResponse } from 'msw' import { ApiEndpoints } from 'uiSrc/constants' import { mswServer } from 'uiSrc/mocks/server' import { getMswURL } from 'uiSrc/utils/test-utils' import { getUrl } from 'uiSrc/utils' -import { RunQueryMode, ResultsMode } from 'uiSrc/slices/interfaces' +import { ResultsMode, RunQueryMode } from 'uiSrc/slices/interfaces' import executeQuery from './executeQuery' describe('executeQuery', () => { @@ -27,19 +27,19 @@ describe('executeQuery', () => { const mockResponse = [{ id: '1', databaseId: instanceId }] mswServer.use( - rest.post( + http.post( getMswURL( getUrl(instanceId, ApiEndpoints.WORKBENCH_COMMAND_EXECUTIONS), ), - async (req, res, ctx) => { - const body = await req.json() + async ({ request }) => { + const body = await request.json() expect(body).toEqual({ commands: [command], mode: RunQueryMode.ASCII, resultsMode: ResultsMode.Default, type: 'SEARCH', }) - return res(ctx.status(200), ctx.json(mockResponse)) + return HttpResponse.json(mockResponse, { status: 200 }) }, ), ) @@ -52,11 +52,13 @@ describe('executeQuery', () => { const mockResponse = [{ id: '1', databaseId: instanceId }] mswServer.use( - rest.post( + http.post( getMswURL( getUrl(instanceId, ApiEndpoints.WORKBENCH_COMMAND_EXECUTIONS), ), - async (_req, res, ctx) => res(ctx.status(200), ctx.json(mockResponse)), + async () => { + HttpResponse.json(mockResponse, { status: 200 }) + }, ), ) @@ -69,11 +71,13 @@ describe('executeQuery', () => { it('invokes onFail and rethrows on error', async () => { mswServer.use( - rest.post( + http.post( getMswURL( getUrl(instanceId, ApiEndpoints.WORKBENCH_COMMAND_EXECUTIONS), ), - async (_req, res, ctx) => res(ctx.status(500)), + async () => { + HttpResponse.text('', { status: 500 }) + }, ), ) diff --git a/redisinsight/ui/src/services/hooks/useLoadData.spec.ts b/redisinsight/ui/src/services/hooks/useLoadData.spec.ts index ba76b335cc..be8ca5b46b 100644 --- a/redisinsight/ui/src/services/hooks/useLoadData.spec.ts +++ b/redisinsight/ui/src/services/hooks/useLoadData.spec.ts @@ -1,5 +1,5 @@ -import { renderHook, act } from '@testing-library/react-hooks' -import { rest } from 'msw' +import { act, renderHook } from '@testing-library/react-hooks' +import { http, HttpResponse } from 'msw' import { ApiEndpoints } from 'uiSrc/constants' import { mswServer } from 'uiSrc/mocks/server' import { getMswURL } from 'uiSrc/utils/test-utils' @@ -33,17 +33,17 @@ describe('useLoadData', () => { } mswServer.use( - rest.post( + http.post( getMswURL( getUrl( instanceId, ApiEndpoints.BULK_ACTIONS_IMPORT_VECTOR_COLLECTION, ), ), - async (req, res, ctx) => { - const body = await req.json() + async ({ request }) => { + const body = await request.json() expect(body).toEqual({ collectionName }) - return res(ctx.status(200), ctx.json(mockResponse)) + return HttpResponse.json(mockResponse, { status: 200 }) }, ), ) @@ -68,16 +68,16 @@ describe('useLoadData', () => { }) mswServer.use( - rest.post( + http.post( getMswURL( getUrl( instanceId, ApiEndpoints.BULK_ACTIONS_IMPORT_VECTOR_COLLECTION, ), ), - async (_, res, ctx) => { + async () => { await requestPromise - return res(ctx.status(200), ctx.json(mockResponse)) + return HttpResponse.json(mockResponse, { status: 200 }) }, ), ) @@ -109,15 +109,16 @@ describe('useLoadData', () => { const errorMessage = 'Network error occurred' mswServer.use( - rest.post( + http.post( getMswURL( getUrl( instanceId, ApiEndpoints.BULK_ACTIONS_IMPORT_VECTOR_COLLECTION, ), ), - async (_, res, ctx) => - res(ctx.status(500), ctx.json({ message: errorMessage })), + async () => { + HttpResponse.json({ message: errorMessage }, { status: 500 }) + }, ), ) @@ -141,19 +142,22 @@ describe('useLoadData', () => { // Mock first call to fail, second to succeed mswServer.use( - rest.post( + http.post( getMswURL( getUrl( instanceId, ApiEndpoints.BULK_ACTIONS_IMPORT_VECTOR_COLLECTION, ), ), - async (_, res, ctx) => { + async () => { callCount++ if (callCount === 1) { - return res(ctx.status(500), ctx.json({ message: 'Server error' })) + return HttpResponse.json( + { message: 'Server error' }, + { status: 500 }, + ) } - return res(ctx.status(200), ctx.json(mockResponse)) + return HttpResponse.json(mockResponse, { status: 200 }) }, ), ) @@ -186,17 +190,17 @@ describe('useLoadData', () => { let callCount = 0 mswServer.use( - rest.post( + http.post( getMswURL( getUrl( instanceId, ApiEndpoints.BULK_ACTIONS_IMPORT_VECTOR_COLLECTION, ), ), - async (_, res, ctx) => { + async () => { callCount++ const response = callCount === 1 ? mockResponse1 : mockResponse2 - return res(ctx.status(200), ctx.json(response)) + return HttpResponse.json(response, { status: 200 }) }, ), ) @@ -225,12 +229,12 @@ describe('useLoadData', () => { const requestBodies: any[] = [] mswServer.use( - rest.post( + http.post( '*/bulk-actions/import/vector-collection', - async (req, res, ctx) => { - const body = await req.json() + async ({ request }) => { + const body = await request.json() requestBodies.push(body) - return res(ctx.status(200), ctx.json(mockResponse)) + return HttpResponse.json(mockResponse, { status: 200 }) }, ), ) diff --git a/redisinsight/ui/src/slices/tests/app/connectivity.spec.ts b/redisinsight/ui/src/slices/tests/app/connectivity.spec.ts index 5ba9e95b6d..43d914d01a 100644 --- a/redisinsight/ui/src/slices/tests/app/connectivity.spec.ts +++ b/redisinsight/ui/src/slices/tests/app/connectivity.spec.ts @@ -1,5 +1,5 @@ import { cloneDeep } from 'lodash' -import { rest } from 'msw' +import { http, HttpResponse } from 'msw' import { waitFor } from '@testing-library/react' import { cleanup, @@ -88,9 +88,9 @@ describe('app connectivity slice', () => { id: '123', // Match the test database ID } - const getDbOverviewMock = jest.fn((_req, res, ctx) => res(ctx.json({}))) + const getDbOverviewMock = jest.fn(() => HttpResponse.json({})) mswServer.use( - rest.get( + http.get( getMswURL(`${ApiEndpoints.DATABASES}/123/overview`), getDbOverviewMock, ), @@ -128,14 +128,14 @@ describe('app connectivity slice', () => { jest.spyOn(store, 'dispatch').mockImplementation((action: any) => { testStore.dispatch(action) }) - const getDbOverviewMock = jest.fn((_req, res, ctx) => - res( - ctx.status(503), - ctx.json({ code: 'serviceUnavailable', message: 'Test error' }), + const getDbOverviewMock = jest.fn(() => + HttpResponse.json( + { code: 'serviceUnavailable', message: 'Test error' }, + { status: 503 }, ), ) mswServer.use( - rest.get( + http.get( getMswURL(`${ApiEndpoints.DATABASES}/123/overview`), getDbOverviewMock, ), @@ -173,14 +173,15 @@ describe('app connectivity slice', () => { jest.spyOn(store, 'dispatch').mockImplementation((action: any) => { testStore.dispatch(action) }) - const getDbOverviewMock = jest.fn((_req, res, ctx) => - res( - ctx.status(503), - ctx.json({ code: 'serviceUnavailable', message: 'Test error' }), - ), - ) + + const getDbOverviewMock = jest.fn(async () => { + return HttpResponse.json( + { code: 'serviceUnavailable', message: 'Test error' }, + { status: 503 }, + ) + }) mswServer.use( - rest.get( + http.get( getMswURL(`${ApiEndpoints.DATABASES}/123/overview`), // ID 123 in URL getDbOverviewMock, ), diff --git a/redisinsight/ui/src/slices/tests/app/init.spec.ts b/redisinsight/ui/src/slices/tests/app/init.spec.ts index 8c54a82708..1adbbbaed5 100644 --- a/redisinsight/ui/src/slices/tests/app/init.spec.ts +++ b/redisinsight/ui/src/slices/tests/app/init.spec.ts @@ -1,5 +1,5 @@ import { cloneDeep } from 'lodash' -import { rest } from 'msw' +import { http, HttpResponse } from 'msw' import reducer, { appInitSelector, FAILED_TO_FETCH_CSRF_TOKEN_ERROR, @@ -131,9 +131,11 @@ describe('init slice', () => { it('failed to init data', async () => { mswServer.use( - rest.get<(typeof FEATURES_DATA_MOCK)[]>( + http.get( getMswURL(ApiEndpoints.FEATURES), - async (_req, res, ctx) => res(ctx.status(500)), + async () => { + HttpResponse.text('', { status: 500 }) + }, ), ) @@ -154,9 +156,11 @@ describe('init slice', () => { it('failed to init csrf', async () => { riConfig.api.csrfEndpoint = 'http://localhost/csrf' mswServer.use( - rest.get( + http.get( getMswURL(riConfig.api.csrfEndpoint), - async (_req, res, ctx) => res(ctx.status(500)), + async () => { + HttpResponse.text('', { status: 500 }) + }, ), ) @@ -189,10 +193,11 @@ describe('init slice', () => { // Arrange mswServer.use( - rest.get<(typeof FEATURES_DATA_MOCK)[]>( + http.get( getMswURL(ApiEndpoints.FEATURES), - async (_req, res, ctx) => - res(ctx.status(200), ctx.json(newFeatureFlags)), + async () => { + HttpResponse.json(newFeatureFlags, { status: 200 }) + }, ), ) From 4bedf1e3abe4458d11183932cc8c40ff6448ec1a Mon Sep 17 00:00:00 2001 From: pd-redis Date: Fri, 17 Oct 2025 09:34:09 +0300 Subject: [PATCH 03/19] update jest config to work with msw 2 --- jest.config.cjs | 5 +++-- package.json | 3 ++- yarn.lock | 7 ++++++- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/jest.config.cjs b/jest.config.cjs index db3d34c823..a617de9f34 100644 --- a/jest.config.cjs +++ b/jest.config.cjs @@ -4,6 +4,7 @@ require('dotenv').config({ path: './redisinsight/ui/.env.test' }); module.exports = { testEnvironmentOptions: { url: 'http://localhost/', + customExportConditions: [''], }, moduleNameMapper: { '\\.(jpg|jpeg|png|ico|gif|eot|otf|webp|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$': @@ -40,9 +41,9 @@ module.exports = { setupFilesAfterEnv: ['/redisinsight/ui/src/setup-tests.ts'], moduleDirectories: ['node_modules', 'redisinsight/node_modules'], moduleFileExtensions: ['js', 'jsx', 'ts', 'tsx', 'json'], - testEnvironment: 'jest-environment-jsdom', + testEnvironment: 'jest-fixed-jsdom', transformIgnorePatterns: [ - 'node_modules/(?!(monaco-editor|react-monaco-editor|brotli-dec-wasm)/)', + 'node_modules/(?!(monaco-editor|react-monaco-editor|brotli-dec-wasm|until-async)/)', ], // TODO: add tests for plugins modulePathIgnorePatterns: [ diff --git a/package.json b/package.json index c21783dd05..d10a8ee3b8 100644 --- a/package.json +++ b/package.json @@ -200,6 +200,7 @@ "ioredis-mock": "^5.5.4", "jest": "^29.7.0", "jest-environment-jsdom": "^29.7.0", + "jest-fixed-jsdom": "^0.0.10", "jest-html-reporters": "^3.1.7", "jest-runner-groups": "^2.2.0", "jest-when": "^3.2.1", @@ -230,7 +231,7 @@ "ts-node": "^10.9.1", "tsconfig-paths": "^3.9.0", "tsconfig-paths-webpack-plugin": "^4.1.0", - "typescript": "^4.9.5", + "typescript": "^4.0.5", "url-loader": "^4.1.0", "vite": "^5.4.20", "vite-bundle-visualizer": "1.0.1", diff --git a/yarn.lock b/yarn.lock index 9f46330cb6..00db30e016 100644 --- a/yarn.lock +++ b/yarn.lock @@ -9693,6 +9693,11 @@ jest-environment-node@^29.7.0: jest-mock "^29.7.0" jest-util "^29.7.0" +jest-fixed-jsdom@^0.0.10: + version "0.0.10" + resolved "https://registry.yarnpkg.com/jest-fixed-jsdom/-/jest-fixed-jsdom-0.0.10.tgz#6f4042d42f2130a0debc85ec0b9e348c4c2de57b" + integrity sha512-WaEVX+FripJh+Hn/7dysIgqP66h0KT1NNC22NGmNYANExtCoYNk1q2yjwwcdSboBMkkhn0NtmvKad/cmisnCLg== + jest-get-type@^29.6.3: version "29.6.3" resolved "https://registry.yarnpkg.com/jest-get-type/-/jest-get-type-29.6.3.tgz#36f499fdcea197c1045a127319c0481723908fd1" @@ -14929,7 +14934,7 @@ typescript@5.6.2: resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.2.tgz#d1de67b6bef77c41823f822df8f0b3bcff60a5a0" integrity sha512-NW8ByodCSNCwZeghjN3o+JX5OFH0Ojg6sadjEKY4huZ52TqbJTJnDo5+Tw98lSy63NZvi4n+ez5m2u5d4PkZyw== -typescript@^4.9.5: +typescript@^4.0.5: version "4.9.5" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.9.5.tgz#095979f9bcc0d09da324d58d03ce8f8374cbe65a" integrity sha512-1FXk9E2Hm+QzZQ7z+McJiHL4NW1F2EzMu9Nq9i3zAaGqibafqYwCVU6WyWAuyQRRzOlxou8xZSyXLEN8oKj24g== From 232e78ae8823a2d625e79a9db5f17fde1bc232f8 Mon Sep 17 00:00:00 2001 From: pd-redis Date: Fri, 17 Oct 2025 12:51:47 +0300 Subject: [PATCH 04/19] fix msw calls --- .../handlers/analytics/clusterDetailsHandlers.ts | 2 +- .../handlers/analytics/dbAnalysisHistoryHandlers.ts | 2 +- .../ui/src/mocks/handlers/app/featureHandlers.ts | 2 +- .../ui/src/mocks/handlers/app/infoHandlers.ts | 2 +- .../ui/src/mocks/handlers/app/telemetryHandlers.ts | 4 ++-- .../mocks/handlers/browser/bulkActionsHandlers.ts | 4 +++- .../src/mocks/handlers/browser/redisearchHandlers.ts | 6 +++--- .../handlers/content/createRedisButtonsHandlers.ts | 2 +- .../mocks/handlers/instances/instancesHandlers.ts | 6 +++--- redisinsight/ui/src/mocks/handlers/oauth/cloud.ts | 4 ++-- redisinsight/ui/src/mocks/handlers/rdi/rdiHandler.ts | 8 ++++---- .../handlers/rdi/rdiPipelineStrategiesHandlers.ts | 2 +- .../recommendations/recommendationsHandler.ts | 4 ++-- .../recommendations/recommendationsReadHandler.ts | 2 +- .../mocks/handlers/tutorials/tutorialsHandlers.ts | 2 +- .../src/mocks/handlers/user/userSettingsHandlers.ts | 2 +- .../ui/src/mocks/handlers/workbench/commands.ts | 4 +++- redisinsight/ui/src/mocks/res/responseComposition.ts | 5 ++++- .../cluster-details/ClusterDetailsPage.spec.tsx | 2 +- redisinsight/ui/src/services/executeQuery.spec.ts | 4 ++-- .../ui/src/services/hooks/useLoadData.spec.ts | 2 +- .../ui/src/slices/tests/app/connectivity.spec.ts | 12 +++++++----- redisinsight/ui/src/slices/tests/app/init.spec.ts | 6 +++--- redisinsight/ui/src/utils/test-utils.tsx | 3 ++- 24 files changed, 51 insertions(+), 41 deletions(-) diff --git a/redisinsight/ui/src/mocks/handlers/analytics/clusterDetailsHandlers.ts b/redisinsight/ui/src/mocks/handlers/analytics/clusterDetailsHandlers.ts index e59b9582f9..de082a4ec2 100644 --- a/redisinsight/ui/src/mocks/handlers/analytics/clusterDetailsHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/analytics/clusterDetailsHandlers.ts @@ -16,7 +16,7 @@ const handlers: HttpHandler[] = [ http.get( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.CLUSTER_DETAILS)), async () => { - HttpResponse.json(CLUSTER_DETAILS_DATA_MOCK, { status: 200 }) + return HttpResponse.json(CLUSTER_DETAILS_DATA_MOCK, { status: 200 }) }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/analytics/dbAnalysisHistoryHandlers.ts b/redisinsight/ui/src/mocks/handlers/analytics/dbAnalysisHistoryHandlers.ts index a757ba3da9..bc3857cf81 100644 --- a/redisinsight/ui/src/mocks/handlers/analytics/dbAnalysisHistoryHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/analytics/dbAnalysisHistoryHandlers.ts @@ -10,7 +10,7 @@ const handlers: HttpHandler[] = [ http.get( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.DATABASE_ANALYSIS)), async () => { - HttpResponse.json(DB_ANALYSIS_HISTORY_DATA_MOCK, { status: 200 }) + return HttpResponse.json(DB_ANALYSIS_HISTORY_DATA_MOCK, { status: 200 }) }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/app/featureHandlers.ts b/redisinsight/ui/src/mocks/handlers/app/featureHandlers.ts index 7c3606ea3e..1dcd9676f0 100644 --- a/redisinsight/ui/src/mocks/handlers/app/featureHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/app/featureHandlers.ts @@ -97,7 +97,7 @@ const handlers: HttpHandler[] = [ http.get( getMswURL(ApiEndpoints.FEATURES), async () => { - HttpResponse.json(FEATURES_DATA_MOCK, { status: 200 }) + return HttpResponse.json(FEATURES_DATA_MOCK, { status: 200 }) }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/app/infoHandlers.ts b/redisinsight/ui/src/mocks/handlers/app/infoHandlers.ts index 8ea801047d..76d644173e 100644 --- a/redisinsight/ui/src/mocks/handlers/app/infoHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/app/infoHandlers.ts @@ -16,7 +16,7 @@ const handlers: HttpHandler[] = [ http.get( getMswURL(ApiEndpoints.INFO), async () => { - HttpResponse.json(APP_INFO_DATA_MOCK, { status: 200 }) + return HttpResponse.json(APP_INFO_DATA_MOCK, { status: 200 }) }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/app/telemetryHandlers.ts b/redisinsight/ui/src/mocks/handlers/app/telemetryHandlers.ts index 1bb96380ab..b8d0750ff1 100644 --- a/redisinsight/ui/src/mocks/handlers/app/telemetryHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/app/telemetryHandlers.ts @@ -5,11 +5,11 @@ import { getMswURL } from 'uiSrc/utils/test-utils' const handlers: HttpHandler[] = [ // sendEventTelemetry http.post(getMswURL(ApiEndpoints.ANALYTICS_SEND_EVENT), async () => { - HttpResponse.text('', { status: 200 }) + return HttpResponse.text('', { status: 200 }) }), // sendPageViewTelemetry http.post(getMswURL(ApiEndpoints.ANALYTICS_SEND_PAGE), async () => { - HttpResponse.text('', { status: 200 }) + return HttpResponse.text('', { status: 200 }) }), ] diff --git a/redisinsight/ui/src/mocks/handlers/browser/bulkActionsHandlers.ts b/redisinsight/ui/src/mocks/handlers/browser/bulkActionsHandlers.ts index e373b0753a..4e20333303 100644 --- a/redisinsight/ui/src/mocks/handlers/browser/bulkActionsHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/browser/bulkActionsHandlers.ts @@ -15,7 +15,9 @@ const handlers: HttpHandler[] = [ ), ), async () => { - HttpResponse.json(bulkActionOverviewFactory.build(), { status: 200 }) + return HttpResponse.json(bulkActionOverviewFactory.build(), { + status: 200, + }) }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/browser/redisearchHandlers.ts b/redisinsight/ui/src/mocks/handlers/browser/redisearchHandlers.ts index 555a54fbe0..f2162e2fca 100644 --- a/redisinsight/ui/src/mocks/handlers/browser/redisearchHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/browser/redisearchHandlers.ts @@ -21,19 +21,19 @@ const handlers: HttpHandler[] = [ http.get( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.REDISEARCH)), async () => { - HttpResponse.json(REDISEARCH_LIST_DATA_MOCK, { status: 200 }) + return HttpResponse.json(REDISEARCH_LIST_DATA_MOCK, { status: 200 }) }, ), http.post( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.REDISEARCH_INFO)), async () => { - HttpResponse.json(indexInfoFactory.build(), { status: 200 }) + return HttpResponse.json(indexInfoFactory.build(), { status: 200 }) }, ), http.delete( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.REDISEARCH)), async () => { - HttpResponse.text('', { status: 204 }) + return HttpResponse.text('', { status: 204 }) }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/content/createRedisButtonsHandlers.ts b/redisinsight/ui/src/mocks/handlers/content/createRedisButtonsHandlers.ts index bc7a8ce1ed..d75477f49c 100644 --- a/redisinsight/ui/src/mocks/handlers/content/createRedisButtonsHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/content/createRedisButtonsHandlers.ts @@ -8,7 +8,7 @@ const handlers: HttpHandler[] = [ http.get( getMswResourceURL(ApiEndpoints.CONTENT_CREATE_DATABASE), async () => { - HttpResponse.json( + return HttpResponse.json( [ { id: 'e37cc441-a4f2-402c-8bdb-fc2413cbbaff', diff --git a/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts b/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts index 3a10e0d0f3..89620a2a14 100644 --- a/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts @@ -85,20 +85,20 @@ const handlers: HttpHandler[] = [ http.post( getMswURL(ApiEndpoints.DATABASES_EXPORT), async () => { - HttpResponse.json(INSTANCES_MOCK, { status: 200 }) + return HttpResponse.json(INSTANCES_MOCK, { status: 200 }) }, ), http.get( getMswURL(getUrl(INSTANCE_ID_MOCK)), async () => { - HttpResponse.json(INSTANCES_MOCK[0], { status: 200 }) + return HttpResponse.json(INSTANCES_MOCK[0], { status: 200 }) }, ), http.get( getMswURL(`/${ApiEndpoints.DATABASES}/:id/info`), // getMswURL(getUrl(INSTANCE_ID_MOCK, 'info')), async () => { - HttpResponse.json(MOCK_INFO_API_RESPONSE, { status: 200 }) + return HttpResponse.json(MOCK_INFO_API_RESPONSE, { status: 200 }) }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/oauth/cloud.ts b/redisinsight/ui/src/mocks/handlers/oauth/cloud.ts index 796af6e89b..cea89dd0ae 100644 --- a/redisinsight/ui/src/mocks/handlers/oauth/cloud.ts +++ b/redisinsight/ui/src/mocks/handlers/oauth/cloud.ts @@ -19,12 +19,12 @@ export const CLOUD_ME_DATA_MOCK = { const handlers: HttpHandler[] = [ // fetch cloud capi keys http.get(getMswURL(ApiEndpoints.CLOUD_CAPI_KEYS), async () => { - HttpResponse.json(OAUTH_CLOUD_CAPI_KEYS_DATA, { status: 200 }) + return HttpResponse.json(OAUTH_CLOUD_CAPI_KEYS_DATA, { status: 200 }) }), // fetch user profile http.get(getMswURL(ApiEndpoints.CLOUD_ME), async () => { - HttpResponse.json(CLOUD_ME_DATA_MOCK, { status: 200 }) + return HttpResponse.json(CLOUD_ME_DATA_MOCK, { status: 200 }) }), ] diff --git a/redisinsight/ui/src/mocks/handlers/rdi/rdiHandler.ts b/redisinsight/ui/src/mocks/handlers/rdi/rdiHandler.ts index 3419214a7b..e2cf597196 100644 --- a/redisinsight/ui/src/mocks/handlers/rdi/rdiHandler.ts +++ b/redisinsight/ui/src/mocks/handlers/rdi/rdiHandler.ts @@ -9,7 +9,7 @@ const handlers: HttpHandler[] = [ http.get( getMswURL(getUrl(ApiEndpoints.RDI_INSTANCES)), async () => { - HttpResponse.json( + return HttpResponse.json( [ { id: '1', @@ -28,17 +28,17 @@ const handlers: HttpHandler[] = [ // create rdi instance http.post(getMswURL(ApiEndpoints.RDI_INSTANCES), async () => { - HttpResponse.json({}, { status: 200 }) + return HttpResponse.json({}, { status: 200 }) }), // update rdi instance http.patch(getMswURL(getUrl('1', ApiEndpoints.RDI_INSTANCES)), async () => { - HttpResponse.json({}, { status: 200 }) + return HttpResponse.json({}, { status: 200 }) }), // delete rdi instance http.delete(getMswURL(ApiEndpoints.RDI_INSTANCES), async () => { - HttpResponse.json({}, { status: 200 }) + return HttpResponse.json({}, { status: 200 }) }), ] diff --git a/redisinsight/ui/src/mocks/handlers/rdi/rdiPipelineStrategiesHandlers.ts b/redisinsight/ui/src/mocks/handlers/rdi/rdiPipelineStrategiesHandlers.ts index e4b4b52207..429f2b5b02 100644 --- a/redisinsight/ui/src/mocks/handlers/rdi/rdiPipelineStrategiesHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/rdi/rdiPipelineStrategiesHandlers.ts @@ -43,7 +43,7 @@ const handlers: HttpHandler[] = [ http.get( getMswURL(getRdiUrl('rdiInstanceId', ApiEndpoints.RDI_PIPELINE_STRATEGIES)), async () => { - HttpResponse.json(MOCK_RDI_STRATEGIES, { status: 200 }) + return HttpResponse.json(MOCK_RDI_STRATEGIES, { status: 200 }) }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/recommendations/recommendationsHandler.ts b/redisinsight/ui/src/mocks/handlers/recommendations/recommendationsHandler.ts index 1d8416c138..b9353f3eef 100644 --- a/redisinsight/ui/src/mocks/handlers/recommendations/recommendationsHandler.ts +++ b/redisinsight/ui/src/mocks/handlers/recommendations/recommendationsHandler.ts @@ -18,13 +18,13 @@ const handlers: HttpHandler[] = [ http.get( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.RECOMMENDATIONS)), async () => { - HttpResponse.json(RECOMMENDATIONS_DATA_MOCK, { status: 200 }) + return HttpResponse.json(RECOMMENDATIONS_DATA_MOCK, { status: 200 }) }, ), http.delete( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.RECOMMENDATIONS)), async () => { - HttpResponse.text({ status: 200 }) + return HttpResponse.text('', { status: 200 }) }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/recommendations/recommendationsReadHandler.ts b/redisinsight/ui/src/mocks/handlers/recommendations/recommendationsReadHandler.ts index f4a02ce21a..50876d89cf 100644 --- a/redisinsight/ui/src/mocks/handlers/recommendations/recommendationsReadHandler.ts +++ b/redisinsight/ui/src/mocks/handlers/recommendations/recommendationsReadHandler.ts @@ -15,7 +15,7 @@ const handlers: HttpHandler[] = [ http.patch( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.RECOMMENDATIONS_READ)), async () => { - HttpResponse.json(EMPTY_RECOMMENDATIONS_MOCK, { status: 200 }) + return HttpResponse.json(EMPTY_RECOMMENDATIONS_MOCK, { status: 200 }) }, ), ] diff --git a/redisinsight/ui/src/mocks/handlers/tutorials/tutorialsHandlers.ts b/redisinsight/ui/src/mocks/handlers/tutorials/tutorialsHandlers.ts index 7da1715049..3cae2e1fbe 100644 --- a/redisinsight/ui/src/mocks/handlers/tutorials/tutorialsHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/tutorials/tutorialsHandlers.ts @@ -4,7 +4,7 @@ import { getMswURL } from 'uiSrc/utils/test-utils' const handlers: HttpHandler[] = [ http.post(getMswURL(ApiEndpoints.CUSTOM_TUTORIALS), () => { - HttpResponse.json({ + return HttpResponse.json({ id: 'f79e82e8-c34a-4dc7-a49e-9fadc0979fda', }) }), diff --git a/redisinsight/ui/src/mocks/handlers/user/userSettingsHandlers.ts b/redisinsight/ui/src/mocks/handlers/user/userSettingsHandlers.ts index a0d655db75..19725e3415 100644 --- a/redisinsight/ui/src/mocks/handlers/user/userSettingsHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/user/userSettingsHandlers.ts @@ -18,7 +18,7 @@ export const USER_SETTINGS_DATA_MOCK = { const handlers: HttpHandler[] = [ http.get(getMswURL(ApiEndpoints.SETTINGS), async () => { - HttpResponse.json(USER_SETTINGS_DATA_MOCK, { status: 200 }) + return HttpResponse.json(USER_SETTINGS_DATA_MOCK, { status: 200 }) }), ] diff --git a/redisinsight/ui/src/mocks/handlers/workbench/commands.ts b/redisinsight/ui/src/mocks/handlers/workbench/commands.ts index c611a68058..85e0ff0548 100644 --- a/redisinsight/ui/src/mocks/handlers/workbench/commands.ts +++ b/redisinsight/ui/src/mocks/handlers/workbench/commands.ts @@ -12,7 +12,9 @@ const handlers: HttpHandler[] = [ getUrl(INSTANCE_ID_MOCK, ApiEndpoints.WORKBENCH_COMMAND_EXECUTIONS), ), async () => { - HttpResponse.json(commandExecutionFactory.buildList(1), { status: 200 }) + return HttpResponse.json(commandExecutionFactory.buildList(1), { + status: 200, + }) }, ), ] diff --git a/redisinsight/ui/src/mocks/res/responseComposition.ts b/redisinsight/ui/src/mocks/res/responseComposition.ts index 1f29c011d1..55059a5405 100644 --- a/redisinsight/ui/src/mocks/res/responseComposition.ts +++ b/redisinsight/ui/src/mocks/res/responseComposition.ts @@ -3,6 +3,9 @@ import { DEFAULT_ERROR_MESSAGE } from 'uiSrc/utils' export const errorHandlers = [ http.all('*', () => { - HttpResponse.json({ message: DEFAULT_ERROR_MESSAGE }, { status: 500 }) + return HttpResponse.json( + { message: DEFAULT_ERROR_MESSAGE }, + { status: 500 }, + ) }), ] diff --git a/redisinsight/ui/src/pages/cluster-details/ClusterDetailsPage.spec.tsx b/redisinsight/ui/src/pages/cluster-details/ClusterDetailsPage.spec.tsx index a5d2bd9609..95feebed70 100644 --- a/redisinsight/ui/src/pages/cluster-details/ClusterDetailsPage.spec.tsx +++ b/redisinsight/ui/src/pages/cluster-details/ClusterDetailsPage.spec.tsx @@ -38,7 +38,7 @@ describe('ClusterDetailsPage', () => { }) it('should call fetchClusterDetailsAction after rendering', async () => { - await act(() => { + await act(async () => { render() }) diff --git a/redisinsight/ui/src/services/executeQuery.spec.ts b/redisinsight/ui/src/services/executeQuery.spec.ts index 4fc2d0b8f5..0315c4c8f6 100644 --- a/redisinsight/ui/src/services/executeQuery.spec.ts +++ b/redisinsight/ui/src/services/executeQuery.spec.ts @@ -57,7 +57,7 @@ describe('executeQuery', () => { getUrl(instanceId, ApiEndpoints.WORKBENCH_COMMAND_EXECUTIONS), ), async () => { - HttpResponse.json(mockResponse, { status: 200 }) + return HttpResponse.json(mockResponse, { status: 200 }) }, ), ) @@ -76,7 +76,7 @@ describe('executeQuery', () => { getUrl(instanceId, ApiEndpoints.WORKBENCH_COMMAND_EXECUTIONS), ), async () => { - HttpResponse.text('', { status: 500 }) + return HttpResponse.text('', { status: 500 }) }, ), ) diff --git a/redisinsight/ui/src/services/hooks/useLoadData.spec.ts b/redisinsight/ui/src/services/hooks/useLoadData.spec.ts index be8ca5b46b..5840d731b8 100644 --- a/redisinsight/ui/src/services/hooks/useLoadData.spec.ts +++ b/redisinsight/ui/src/services/hooks/useLoadData.spec.ts @@ -117,7 +117,7 @@ describe('useLoadData', () => { ), ), async () => { - HttpResponse.json({ message: errorMessage }, { status: 500 }) + return HttpResponse.json({ message: errorMessage }, { status: 500 }) }, ), ) diff --git a/redisinsight/ui/src/slices/tests/app/connectivity.spec.ts b/redisinsight/ui/src/slices/tests/app/connectivity.spec.ts index 43d914d01a..de539d652e 100644 --- a/redisinsight/ui/src/slices/tests/app/connectivity.spec.ts +++ b/redisinsight/ui/src/slices/tests/app/connectivity.spec.ts @@ -88,7 +88,9 @@ describe('app connectivity slice', () => { id: '123', // Match the test database ID } - const getDbOverviewMock = jest.fn(() => HttpResponse.json({})) + const getDbOverviewMock = jest.fn(() => { + return HttpResponse.json({}) + }) mswServer.use( http.get( getMswURL(`${ApiEndpoints.DATABASES}/123/overview`), @@ -128,12 +130,12 @@ describe('app connectivity slice', () => { jest.spyOn(store, 'dispatch').mockImplementation((action: any) => { testStore.dispatch(action) }) - const getDbOverviewMock = jest.fn(() => - HttpResponse.json( + const getDbOverviewMock = jest.fn(() => { + return HttpResponse.json( { code: 'serviceUnavailable', message: 'Test error' }, { status: 503 }, - ), - ) + ) + }) mswServer.use( http.get( getMswURL(`${ApiEndpoints.DATABASES}/123/overview`), diff --git a/redisinsight/ui/src/slices/tests/app/init.spec.ts b/redisinsight/ui/src/slices/tests/app/init.spec.ts index 1adbbbaed5..e767200444 100644 --- a/redisinsight/ui/src/slices/tests/app/init.spec.ts +++ b/redisinsight/ui/src/slices/tests/app/init.spec.ts @@ -134,7 +134,7 @@ describe('init slice', () => { http.get( getMswURL(ApiEndpoints.FEATURES), async () => { - HttpResponse.text('', { status: 500 }) + return HttpResponse.text('', { status: 500 }) }, ), ) @@ -159,7 +159,7 @@ describe('init slice', () => { http.get( getMswURL(riConfig.api.csrfEndpoint), async () => { - HttpResponse.text('', { status: 500 }) + return HttpResponse.text('', { status: 500 }) }, ), ) @@ -196,7 +196,7 @@ describe('init slice', () => { http.get( getMswURL(ApiEndpoints.FEATURES), async () => { - HttpResponse.json(newFeatureFlags, { status: 200 }) + return HttpResponse.json(newFeatureFlags, { status: 200 }) }, ), ) diff --git a/redisinsight/ui/src/utils/test-utils.tsx b/redisinsight/ui/src/utils/test-utils.tsx index 99af3ed33d..68af3a6d59 100644 --- a/redisinsight/ui/src/utils/test-utils.tsx +++ b/redisinsight/ui/src/utils/test-utils.tsx @@ -389,7 +389,7 @@ Object.defineProperty(window, 'sessionStorage', { value: sessionStorageMock }) const scrollIntoViewMock = jest.fn() window.HTMLElement.prototype.scrollIntoView = scrollIntoViewMock -const matchMediaMock = () => ({ +const matchMediaMock = (_: any) => ({ matches: false, addEventListener: jest.fn(), removeEventListener: jest.fn(), @@ -402,6 +402,7 @@ Object.defineProperty(window, 'matchMedia', { export const getMswResourceURL = (path: string = '') => RESOURCES_BASE_URL.concat(path) + export const getMswURL = (path: string = '') => apiService.defaults.baseURL?.concat( path.startsWith('/') ? path.slice(1) : path, From 0798f5f465f6c70b68c746f54da906522d85df9b Mon Sep 17 00:00:00 2001 From: pd-redis Date: Fri, 17 Oct 2025 13:14:03 +0300 Subject: [PATCH 05/19] fix msw calls --- .../InfiniteMessages.spec.tsx | 10 +++---- .../handlers/user/userSettingsHandlers.ts | 7 ++++- .../instance/instanceConnectionLost.spec.tsx | 16 ++++++------ .../manage-indexes/IndexSection.spec.tsx | 26 +++++++++++-------- 4 files changed, 33 insertions(+), 26 deletions(-) diff --git a/redisinsight/ui/src/components/notifications/components/infinite-messages/InfiniteMessages.spec.tsx b/redisinsight/ui/src/components/notifications/components/infinite-messages/InfiniteMessages.spec.tsx index af6c001d88..2f5a29c627 100644 --- a/redisinsight/ui/src/components/notifications/components/infinite-messages/InfiniteMessages.spec.tsx +++ b/redisinsight/ui/src/components/notifications/components/infinite-messages/InfiniteMessages.spec.tsx @@ -1,5 +1,5 @@ import React from 'react' -import { fireEvent, render, screen } from 'uiSrc/utils/test-utils' +import { fireEvent, render, screen, act } from 'uiSrc/utils/test-utils' import { OAuthProvider } from 'uiSrc/components/oauth/oauth-select-plan/constants' import notificationsReducer, { @@ -19,24 +19,22 @@ const createTestStore = () => getDefaultMiddleware({ serializableCheck: false }), }) -const renderToast = (notification: InfiniteMessage) => { +const renderToast = async (notification: InfiniteMessage) => { const store = createTestStore() render( <> - {/* */} , { store }, ) - - store.dispatch(addInfiniteNotification(notification)) + await act(async () => store.dispatch(addInfiniteNotification(notification))) } describe('INFINITE_MESSAGES', () => { describe('AUTHENTICATING', () => { it('should render message', async () => { - renderToast(INFINITE_MESSAGES.AUTHENTICATING()) + await renderToast(INFINITE_MESSAGES.AUTHENTICATING()) // Wait for the notification to appear const title = await screen.findByText('Authenticating…') diff --git a/redisinsight/ui/src/mocks/handlers/user/userSettingsHandlers.ts b/redisinsight/ui/src/mocks/handlers/user/userSettingsHandlers.ts index 19725e3415..4c21d97500 100644 --- a/redisinsight/ui/src/mocks/handlers/user/userSettingsHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/user/userSettingsHandlers.ts @@ -16,8 +16,13 @@ export const USER_SETTINGS_DATA_MOCK = { }, } +const apiSettings = getMswURL(ApiEndpoints.SETTINGS) + const handlers: HttpHandler[] = [ - http.get(getMswURL(ApiEndpoints.SETTINGS), async () => { + http.get(apiSettings, async () => { + return HttpResponse.json(USER_SETTINGS_DATA_MOCK, { status: 200 }) + }), + http.patch(apiSettings, async () => { return HttpResponse.json(USER_SETTINGS_DATA_MOCK, { status: 200 }) }), ] diff --git a/redisinsight/ui/src/pages/instance/instanceConnectionLost.spec.tsx b/redisinsight/ui/src/pages/instance/instanceConnectionLost.spec.tsx index 310a90ee94..89b1569902 100644 --- a/redisinsight/ui/src/pages/instance/instanceConnectionLost.spec.tsx +++ b/redisinsight/ui/src/pages/instance/instanceConnectionLost.spec.tsx @@ -1,7 +1,7 @@ import React from 'react' import { fireEvent, screen, waitFor, within } from '@testing-library/react' -import { cloneDeep, set } from 'lodash' -import { rest } from 'msw' +import { cloneDeep } from 'lodash' +import { http, HttpResponse } from 'msw' import { mswServer } from 'uiSrc/mocks/server' import { getMswURL, @@ -54,17 +54,17 @@ describe('instanceConnectionLost', () => { ) mswServer.use( - rest.get( + http.get( getMswURL(`${ApiEndpoints.DATABASES}/instanceId/overview`), - async (_, res, ctx) => { + async () => { if (type === 'error') { - return res( - ctx.status(503), - ctx.json({ error: 'test', code: 'serviceUnavailable' }), + return HttpResponse.json( + { error: 'test', code: 'serviceUnavailable' }, + { status: 503 }, ) } - return res(ctx.status(200), ctx.json(INSTANCES_MOCK)) + return HttpResponse.json(INSTANCES_MOCK, { status: 200 }) }, ), ) diff --git a/redisinsight/ui/src/pages/vector-search/manage-indexes/IndexSection.spec.tsx b/redisinsight/ui/src/pages/vector-search/manage-indexes/IndexSection.spec.tsx index e91a53b2f7..4e045db6c7 100644 --- a/redisinsight/ui/src/pages/vector-search/manage-indexes/IndexSection.spec.tsx +++ b/redisinsight/ui/src/pages/vector-search/manage-indexes/IndexSection.spec.tsx @@ -1,6 +1,6 @@ import React from 'react' import { Provider } from 'react-redux' -import { rest } from 'msw' +import { http, HttpResponse } from 'msw' import { configureStore, combineReducers } from '@reduxjs/toolkit' import { mswServer } from 'uiSrc/mocks/server' import { @@ -130,9 +130,11 @@ describe('IndexSection', () => { // Override the MSW handler to return an error for this test mswServer.use( - rest.post( + http.post( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.REDISEARCH_INFO)), - async (_req, res, ctx) => res(ctx.status(200), ctx.json(mockIndexInfo)), + async () => { + return HttpResponse.json(mockIndexInfo, { status: 200 }) + }, ), ) @@ -183,9 +185,11 @@ describe('IndexSection', () => { // Override the MSW handler to return an error for this test mswServer.use( - rest.post( + http.post( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.REDISEARCH_INFO)), - async (_req, res, ctx) => res(ctx.status(200), ctx.json(mockIndexInfo)), + async () => { + return HttpResponse.json(mockIndexInfo, { status: 200 }) + }, ), ) @@ -344,16 +348,16 @@ describe('IndexSection', () => { it('should handle deletion failure gracefully', async () => { // Override the MSW handler to return an error for this test mswServer.use( - rest.delete( + http.delete( getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.REDISEARCH)), - async (_req, res, ctx) => - res( - ctx.status(500), - ctx.json({ + async () => + HttpResponse.json( + { error: 'Internal Server Error', statusCode: 500, message: 'Failed to delete index', - }), + }, + { status: 500 }, ), ), ) From bc911cb72967966f3ac6518f6b84aa57388dc6c8 Mon Sep 17 00:00:00 2001 From: pd-redis Date: Mon, 20 Oct 2025 10:04:58 +0300 Subject: [PATCH 06/19] fix msw calls --- .../analytics/dbAnalysisHistoryHandlers.ts | 6 ++++++ redisinsight/ui/src/mocks/handlers/misc/index.ts | 15 +++++++++++++++ .../template-form/TemplateForm.spec.tsx | 2 +- 3 files changed, 22 insertions(+), 1 deletion(-) create mode 100644 redisinsight/ui/src/mocks/handlers/misc/index.ts diff --git a/redisinsight/ui/src/mocks/handlers/analytics/dbAnalysisHistoryHandlers.ts b/redisinsight/ui/src/mocks/handlers/analytics/dbAnalysisHistoryHandlers.ts index bc3857cf81..cac3d30647 100644 --- a/redisinsight/ui/src/mocks/handlers/analytics/dbAnalysisHistoryHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/analytics/dbAnalysisHistoryHandlers.ts @@ -13,6 +13,12 @@ const handlers: HttpHandler[] = [ return HttpResponse.json(DB_ANALYSIS_HISTORY_DATA_MOCK, { status: 200 }) }, ), + http.post( + getMswURL(getUrl(INSTANCE_ID_MOCK, ApiEndpoints.DATABASE_ANALYSIS)), + async () => { + return HttpResponse.json({}, { status: 200 }) + }, + ), ] export const DB_ANALYSIS_HISTORY_DATA_MOCK = [ diff --git a/redisinsight/ui/src/mocks/handlers/misc/index.ts b/redisinsight/ui/src/mocks/handlers/misc/index.ts new file mode 100644 index 0000000000..17ea7658cd --- /dev/null +++ b/redisinsight/ui/src/mocks/handlers/misc/index.ts @@ -0,0 +1,15 @@ +import { getMswURL } from 'uiSrc/utils/test-utils' +import { ApiEndpoints } from 'uiSrc/constants' +import { http, HttpHandler, HttpResponse } from 'msw' +import { USER_SETTINGS_DATA_MOCK } from 'uiSrc/mocks/handlers/user/userSettingsHandlers' + +const apiSettings = getMswURL(ApiEndpoints.SETTINGS) + +export const handlers: HttpHandler[] = [ + http.get(apiSettings, async () => { + return HttpResponse.json(USER_SETTINGS_DATA_MOCK, { status: 200 }) + }), + http.patch(apiSettings, async () => { + return HttpResponse.json(USER_SETTINGS_DATA_MOCK, { status: 200 }) + }), +] diff --git a/redisinsight/ui/src/pages/rdi/pipeline-management/components/template-form/TemplateForm.spec.tsx b/redisinsight/ui/src/pages/rdi/pipeline-management/components/template-form/TemplateForm.spec.tsx index b38148124a..d591502b68 100644 --- a/redisinsight/ui/src/pages/rdi/pipeline-management/components/template-form/TemplateForm.spec.tsx +++ b/redisinsight/ui/src/pages/rdi/pipeline-management/components/template-form/TemplateForm.spec.tsx @@ -62,7 +62,7 @@ describe('TemplateForm', () => { }) it('should fetch rdi strategies on initial', async () => { - await act(() => { + await act(async () => { render() }) From 8638485940fc7548b3cf6019a3a5987fd9457eba Mon Sep 17 00:00:00 2001 From: Artsiom Kharuzhenka Date: Fri, 24 Oct 2025 09:41:05 +0300 Subject: [PATCH 07/19] use simpler solution for blob reader (#5105) --- .../BulkDeleteSummaryButton.spec.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/redisinsight/ui/src/pages/browser/components/bulk-actions/BulkDelete/BulkDeleteSummaryButton/BulkDeleteSummaryButton.spec.tsx b/redisinsight/ui/src/pages/browser/components/bulk-actions/BulkDelete/BulkDeleteSummaryButton/BulkDeleteSummaryButton.spec.tsx index ff2ba0a6f0..b62efe4866 100644 --- a/redisinsight/ui/src/pages/browser/components/bulk-actions/BulkDelete/BulkDeleteSummaryButton/BulkDeleteSummaryButton.spec.tsx +++ b/redisinsight/ui/src/pages/browser/components/bulk-actions/BulkDelete/BulkDeleteSummaryButton/BulkDeleteSummaryButton.spec.tsx @@ -2,12 +2,9 @@ import React from 'react' import { render, screen } from '@testing-library/react' import BulkDeleteSummaryButton from './BulkDeleteSummaryButton' -const readBlobContent = (blob: Blob) => - new Promise((resolve) => { - const reader = new FileReader() - reader.onload = () => resolve(reader.result) - reader.readAsText(blob) - }) +const readBlobContent = async (blob: Blob): Promise => { + return blob.text() +} const defaultRenderProps = { pattern: 'test-pattern', From 967d6781c974e13181e3b5c3a2f865478128c0f4 Mon Sep 17 00:00:00 2001 From: pd-redis Date: Fri, 24 Oct 2025 10:25:58 +0300 Subject: [PATCH 08/19] mock File for jest --- .../upload-file/UploadFile.spec.tsx | 2 +- .../src/components/upload-file/UploadFile.tsx | 12 +++++------- redisinsight/ui/src/setup-tests.ts | 19 +++++++++++++++++++ 3 files changed, 25 insertions(+), 8 deletions(-) diff --git a/redisinsight/ui/src/components/upload-file/UploadFile.spec.tsx b/redisinsight/ui/src/components/upload-file/UploadFile.spec.tsx index 78df6a001e..bc2e608f3b 100644 --- a/redisinsight/ui/src/components/upload-file/UploadFile.spec.tsx +++ b/redisinsight/ui/src/components/upload-file/UploadFile.spec.tsx @@ -35,7 +35,7 @@ describe('UploadFile', () => { const fileInput = screen.getByTestId('upload-input-file') fireEvent.change(fileInput, { target: { files: [file] } }) - await waitFor(() => expect(onFileChange).toBeCalled()) + await waitFor(() => expect(onFileChange).toHaveBeenCalled()) await waitFor(() => expect(screen.getByTestId('upload-input-file')).toHaveValue(''), ) diff --git a/redisinsight/ui/src/components/upload-file/UploadFile.tsx b/redisinsight/ui/src/components/upload-file/UploadFile.tsx index 854f7b1316..bda8521e89 100644 --- a/redisinsight/ui/src/components/upload-file/UploadFile.tsx +++ b/redisinsight/ui/src/components/upload-file/UploadFile.tsx @@ -16,13 +16,11 @@ const UploadFile = (props: Props) => { const { onFileChange, onClick, accept, id = 'upload-input-file' } = props const handleFileChange = (e: React.ChangeEvent) => { - if (e.target.files && e.target.files[0]) { - const reader = new FileReader() - reader.onload = async (e) => { - onFileChange(e?.target?.result as string) - } - reader.readAsText(e.target.files[0]) - // reset input value after reading file + if (e.target.files && e.target.files.length > 0) { + const fileBlob = e.target.files[0] + fileBlob.text().then((text) => { + onFileChange(text) + }) e.target.value = '' } } diff --git a/redisinsight/ui/src/setup-tests.ts b/redisinsight/ui/src/setup-tests.ts index 19a1417e53..3f4f6e6e68 100644 --- a/redisinsight/ui/src/setup-tests.ts +++ b/redisinsight/ui/src/setup-tests.ts @@ -15,12 +15,31 @@ class ResizeObserver { disconnect() {} } +class File extends Blob { + constructor(fileBits: any[], fileName: string, options?: any) { + super(fileBits, options) + this.name = fileName + } + + lastModified = Date.now() + + name = 'test-file' + + webkitRelativePath = '' +} + Object.defineProperty(window, 'ResizeObserver', { writable: true, configurable: true, value: ResizeObserver, }) +Object.defineProperty(window, 'File', { + writable: true, + configurable: true, + value: File, +}) + beforeAll(() => { mswServer.listen() }) From 612469814caed3e342d34d7c3ad99c7f5aed631b Mon Sep 17 00:00:00 2001 From: pd-redis Date: Fri, 24 Oct 2025 11:17:57 +0300 Subject: [PATCH 09/19] fix tests --- .../template-form/TemplateForm.spec.tsx | 17 +++++++++-------- .../ui/src/slices/tests/app/init.spec.ts | 10 ++++++++-- 2 files changed, 17 insertions(+), 10 deletions(-) diff --git a/redisinsight/ui/src/pages/rdi/pipeline-management/components/template-form/TemplateForm.spec.tsx b/redisinsight/ui/src/pages/rdi/pipeline-management/components/template-form/TemplateForm.spec.tsx index d591502b68..75a814d7c4 100644 --- a/redisinsight/ui/src/pages/rdi/pipeline-management/components/template-form/TemplateForm.spec.tsx +++ b/redisinsight/ui/src/pages/rdi/pipeline-management/components/template-form/TemplateForm.spec.tsx @@ -3,19 +3,19 @@ import { cloneDeep } from 'lodash' import { instance, mock } from 'ts-mockito' import { - fireEvent, - render, + act, cleanup, + fireEvent, mockedStore, + render, screen, - act, } from 'uiSrc/utils/test-utils' import { getPipelineStrategies, rdiPipelineStrategiesSelector, } from 'uiSrc/slices/rdi/pipeline' import { RdiPipelineTabs } from 'uiSrc/slices/interfaces' -import { NO_TEMPLATE_LABEL, INGEST_OPTION } from './constants' +import { INGEST_OPTION, NO_TEMPLATE_LABEL } from './constants' import TemplateForm, { Props } from './TemplateForm' const mockedProps = mock() @@ -58,7 +58,7 @@ describe('TemplateForm', () => { fireEvent.click(screen.getByTestId('template-cancel-btn')) - expect(mockClosePopover).toBeCalled() + expect(mockClosePopover).toHaveBeenCalled() }) it('should fetch rdi strategies on initial', async () => { @@ -66,9 +66,10 @@ describe('TemplateForm', () => { render() }) - const expectedActions = [getPipelineStrategies()] - expect(store.getActions().slice(0, expectedActions.length)).toEqual( - expectedActions, + const expectedActions = getPipelineStrategies() + + expect(store.getActions()).toEqual( + expect.arrayContaining([expectedActions]), ) }) diff --git a/redisinsight/ui/src/slices/tests/app/init.spec.ts b/redisinsight/ui/src/slices/tests/app/init.spec.ts index e767200444..f7cc2f2a0e 100644 --- a/redisinsight/ui/src/slices/tests/app/init.spec.ts +++ b/redisinsight/ui/src/slices/tests/app/init.spec.ts @@ -24,6 +24,7 @@ import { getFeatureFlags, getFeatureFlagsFailure, getFeatureFlagsSuccess, + setFeaturesToHighlight, } from 'uiSrc/slices/app/features' import { getConfig } from 'uiSrc/config' import { @@ -154,12 +155,17 @@ describe('init slice', () => { }) it('failed to init csrf', async () => { - riConfig.api.csrfEndpoint = 'http://localhost/csrf' + riConfig.api.csrfEndpoint = 'csrf' mswServer.use( http.get( getMswURL(riConfig.api.csrfEndpoint), async () => { - return HttpResponse.text('', { status: 500 }) + return HttpResponse.json( + { + message: 'Network Error', + }, + { status: 500 }, + ) }, ), ) From 19bafbf4cc6751e7e20e9227156113d0538fbdb4 Mon Sep 17 00:00:00 2001 From: pd-redis Date: Fri, 24 Oct 2025 16:18:05 +0300 Subject: [PATCH 10/19] fix SavedQueriesScreen.spec.tsx by changing jest-environment --- .../vector-search/saved-queries/SavedQueriesScreen.spec.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/redisinsight/ui/src/pages/vector-search/saved-queries/SavedQueriesScreen.spec.tsx b/redisinsight/ui/src/pages/vector-search/saved-queries/SavedQueriesScreen.spec.tsx index 9ab632376f..9329ca195e 100644 --- a/redisinsight/ui/src/pages/vector-search/saved-queries/SavedQueriesScreen.spec.tsx +++ b/redisinsight/ui/src/pages/vector-search/saved-queries/SavedQueriesScreen.spec.tsx @@ -1,5 +1,5 @@ /** - * @jest-environment jsdom + * @jest-environment jest-fixed-jsdom */ import React from 'react' import { render, screen, fireEvent } from 'uiSrc/utils/test-utils' From dddf50994c86f7feb1e311cab3236d4fcb7c6a03 Mon Sep 17 00:00:00 2001 From: pd-redis Date: Fri, 24 Oct 2025 16:42:44 +0300 Subject: [PATCH 11/19] fix init.spec.ts to reflect error from axios --- redisinsight/ui/src/slices/tests/app/init.spec.ts | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/redisinsight/ui/src/slices/tests/app/init.spec.ts b/redisinsight/ui/src/slices/tests/app/init.spec.ts index f7cc2f2a0e..6f8ea0596a 100644 --- a/redisinsight/ui/src/slices/tests/app/init.spec.ts +++ b/redisinsight/ui/src/slices/tests/app/init.spec.ts @@ -24,7 +24,6 @@ import { getFeatureFlags, getFeatureFlagsFailure, getFeatureFlagsSuccess, - setFeaturesToHighlight, } from 'uiSrc/slices/app/features' import { getConfig } from 'uiSrc/config' import { @@ -157,15 +156,10 @@ describe('init slice', () => { it('failed to init csrf', async () => { riConfig.api.csrfEndpoint = 'csrf' mswServer.use( - http.get( + http.get( getMswURL(riConfig.api.csrfEndpoint), async () => { - return HttpResponse.json( - { - message: 'Network Error', - }, - { status: 500 }, - ) + return HttpResponse.text('', { status: 500 }) }, ), ) @@ -177,7 +171,7 @@ describe('init slice', () => { const expectedActions = [ initializeAppState(), fetchCsrfToken(), - fetchCsrfTokenFail({ error: 'Network Error' }), + fetchCsrfTokenFail({ error: 'Request failed with status code 500' }), initializeAppStateFail({ error: FAILED_TO_FETCH_CSRF_TOKEN_ERROR }), ] From a88ab7755f9811dbd36a5fee9f15a034472c0593 Mon Sep 17 00:00:00 2001 From: pd-redis Date: Fri, 24 Oct 2025 17:16:15 +0300 Subject: [PATCH 12/19] fix instancesHandlers --- .../ui/src/mocks/handlers/instances/instancesHandlers.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts b/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts index 89620a2a14..31eee9238d 100644 --- a/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts @@ -72,8 +72,8 @@ export const INSTANCES_MOCK: Instance[] = [ export const getDatabasesApiSpy = jest .fn() - .mockImplementation(async (_req, res, ctx) => - res(ctx.status(200), ctx.json(INSTANCES_MOCK)), + .mockImplementation(async () => + HttpResponse.json(INSTANCES_MOCK, { status: 200 }), ) const handlers: HttpHandler[] = [ From 6fba2c6b5f3286db75f4db4802a7937d7f63ae5d Mon Sep 17 00:00:00 2001 From: Artsiom Kharuzhenka Date: Mon, 27 Oct 2025 17:43:16 +0200 Subject: [PATCH 13/19] RI-7676: fix msw unhandled requests causing libuv error (#5111) * RI-7676: fix msw unhandled requests causing libuv error --- redisinsight/ui/src/setup-tests.ts | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/redisinsight/ui/src/setup-tests.ts b/redisinsight/ui/src/setup-tests.ts index 3f4f6e6e68..213bcbf319 100644 --- a/redisinsight/ui/src/setup-tests.ts +++ b/redisinsight/ui/src/setup-tests.ts @@ -41,7 +41,25 @@ Object.defineProperty(window, 'File', { }) beforeAll(() => { - mswServer.listen() + // mswServer.listen() + mswServer.listen({ + onUnhandledRequest: ((req: any, res: any, ctx: any) => { + const url = req.url.href + const method = req.method + const testName = expect.getState()?.currentTestName ?? 'unknown test' + + // Log it nicely + console.warn(`[MSW][${testName}] Unhandled request: ${method} ${url}`) + + // throw to fail the test??? + // tmp: just return empty object to fix libuv error. + // todo: need to find all unhandled requests and probably throw right from here and close socket + return res( + ctx.status(200), + ctx.json({}) + ) + }) as any, + }) }) afterEach(() => { From fcd106c075c69e01ec86b2a7b81db181dae4f544 Mon Sep 17 00:00:00 2001 From: pd-redis Date: Wed, 29 Oct 2025 14:56:39 +0200 Subject: [PATCH 14/19] fix AutoRefresh.spec.tsx, OAuthConnectFreeDb.spec.tsx --- .../auto-refresh/AutoRefresh.spec.tsx | 21 +++++++------ .../OAuthConnectFreeDb.spec.tsx | 16 +++------- .../handlers/instances/instancesHandlers.ts | 31 +++++++------------ 3 files changed, 27 insertions(+), 41 deletions(-) diff --git a/redisinsight/ui/src/components/auto-refresh/AutoRefresh.spec.tsx b/redisinsight/ui/src/components/auto-refresh/AutoRefresh.spec.tsx index d5c31832c4..245cc7ae81 100644 --- a/redisinsight/ui/src/components/auto-refresh/AutoRefresh.spec.tsx +++ b/redisinsight/ui/src/components/auto-refresh/AutoRefresh.spec.tsx @@ -63,7 +63,7 @@ describe('AutoRefresh', () => { render() fireEvent.click(screen.getByTestId('refresh-btn')) - expect(onRefresh).toBeCalled() + expect(onRefresh).toHaveBeenCalled() }) it('refresh text should contain "Last refresh" time with disabled auto-refresh', async () => { @@ -170,22 +170,23 @@ describe('AutoRefresh', () => { }) expect(screen.getByTestId(INLINE_ITEM_EDITOR)).toHaveValue('1') - screen.getByTestId(/apply-btn/).click() + await userEvent.click(screen.getByTestId(/apply-btn/)) + // screen.getByTestId(/apply-btn/).click() await act(async () => { await new Promise((r) => setTimeout(r, 1300)) }) - expect(onRefresh).toBeCalledTimes(1) + expect(onRefresh).toHaveBeenCalledTimes(1) await act(async () => { await new Promise((r) => setTimeout(r, 1300)) }) - expect(onRefresh).toBeCalledTimes(2) + expect(onRefresh).toHaveBeenCalledTimes(2) await act(async () => { await new Promise((r) => setTimeout(r, 1300)) }) - expect(onRefresh).toBeCalledTimes(3) + expect(onRefresh).toHaveBeenCalledTimes(3) }) it('should respect minimumRefreshRate when setting refresh rate', async () => { @@ -279,7 +280,7 @@ describe('AutoRefresh', () => { screen.getByTestId(/apply-btn/).click() - await act(() => { + await act(async () => { rerender( { await act(async () => { await new Promise((r) => setTimeout(r, 1300)) }) - expect(onRefresh).toBeCalledTimes(0) + expect(onRefresh).toHaveBeenCalledTimes(0) await act(async () => { await new Promise((r) => setTimeout(r, 1300)) }) - expect(onRefresh).toBeCalledTimes(0) + expect(onRefresh).toHaveBeenCalledTimes(0) - await act(() => { + await act(async () => { rerender( { await act(async () => { await new Promise((r) => setTimeout(r, 1300)) }) - expect(onRefresh).toBeCalledTimes(1) + expect(onRefresh).toHaveBeenCalledTimes(1) }) it('refresh tooltip text should contain disabled refresh button reason message when button disabled', async () => { diff --git a/redisinsight/ui/src/components/oauth/oauth-connect-free-db/OAuthConnectFreeDb.spec.tsx b/redisinsight/ui/src/components/oauth/oauth-connect-free-db/OAuthConnectFreeDb.spec.tsx index 356f3d3777..8ac9ac0fe9 100644 --- a/redisinsight/ui/src/components/oauth/oauth-connect-free-db/OAuthConnectFreeDb.spec.tsx +++ b/redisinsight/ui/src/components/oauth/oauth-connect-free-db/OAuthConnectFreeDb.spec.tsx @@ -1,12 +1,6 @@ import React from 'react' import { cloneDeep } from 'lodash' -import { - act, - cleanup, - fireEvent, - mockedStore, - render, -} from 'uiSrc/utils/test-utils' +import { cleanup, mockedStore, render, userEvent } from 'uiSrc/utils/test-utils' import { getRedisModulesSummary, sendEventTelemetry, @@ -15,6 +9,7 @@ import { import { freeInstancesSelector, setDefaultInstance, + setDefaultInstanceSuccess, } from 'uiSrc/slices/instances/instances' import { OAuthSocialSource } from 'uiSrc/slices/interfaces' import { setCapability } from 'uiSrc/slices/app/context' @@ -63,10 +58,8 @@ describe('OAuthConnectFreeDb', () => { const { queryByTestId } = render() - await act(() => - fireEvent.click( - queryByTestId('connect-free-db-btn') as HTMLButtonElement, - ), + await userEvent.click( + queryByTestId('connect-free-db-btn') as HTMLButtonElement, ) expect(sendEventTelemetry).toHaveBeenCalledWith({ @@ -86,6 +79,7 @@ describe('OAuthConnectFreeDb', () => { tutorialPopoverShown: false, }), setDefaultInstance(), + setDefaultInstanceSuccess(), ] expect(store.getActions()).toEqual(expectedActions) }) diff --git a/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts b/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts index 31eee9238d..e8eb599a7a 100644 --- a/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts @@ -1,12 +1,9 @@ import { http, HttpHandler, HttpResponse } from 'msw' -import { RedisNodeInfoResponse } from 'src/modules/database/dto/redis-info.dto' import { ApiEndpoints } from 'uiSrc/constants' import { ConnectionType, Instance } from 'uiSrc/slices/interfaces' import { getMswURL } from 'uiSrc/utils/test-utils' import { getUrl } from 'uiSrc/utils' import { MOCK_INFO_API_RESPONSE } from 'uiSrc/mocks/data/instances' -import { Database as DatabaseInstanceResponse } from 'apiSrc/modules/database/models/database' -import { ExportDatabase } from 'apiSrc/modules/database/models/export-database' export const INSTANCE_ID_MOCK = 'instanceId' export const INSTANCES_MOCK: Instance[] = [ @@ -78,29 +75,23 @@ export const getDatabasesApiSpy = jest const handlers: HttpHandler[] = [ // fetchInstancesAction - http.get( - getMswURL(ApiEndpoints.DATABASES), - getDatabasesApiSpy, - ), - http.post( - getMswURL(ApiEndpoints.DATABASES_EXPORT), - async () => { - return HttpResponse.json(INSTANCES_MOCK, { status: 200 }) - }, - ), - http.get( - getMswURL(getUrl(INSTANCE_ID_MOCK)), - async () => { - return HttpResponse.json(INSTANCES_MOCK[0], { status: 200 }) - }, - ), - http.get( + http.get(getMswURL(ApiEndpoints.DATABASES), getDatabasesApiSpy), + http.post(getMswURL(ApiEndpoints.DATABASES_EXPORT), async () => { + return HttpResponse.json(INSTANCES_MOCK, { status: 200 }) + }), + http.get(getMswURL(getUrl(INSTANCE_ID_MOCK)), async () => { + return HttpResponse.json(INSTANCES_MOCK[0], { status: 200 }) + }), + http.get( getMswURL(`/${ApiEndpoints.DATABASES}/:id/info`), // getMswURL(getUrl(INSTANCE_ID_MOCK, 'info')), async () => { return HttpResponse.json(MOCK_INFO_API_RESPONSE, { status: 200 }) }, ), + http.get(getMswURL(`${ApiEndpoints.DATABASES}/:id/connect`), async () => { + return HttpResponse.text('', { status: 200 }) + }), ] // rest.post(`${ApiEndpoints.INSTANCE}`, (req, res, ctx) => { From daa238b52f82ae5821d17003f3aae51f7045e53e Mon Sep 17 00:00:00 2001 From: pd-redis Date: Wed, 29 Oct 2025 15:33:02 +0200 Subject: [PATCH 15/19] fix FilterKeyType.spec.tsx, AddDatabaseScreen.spec.tsx, FetchPipelinePopover.spec.tsx, TemplateForm.spec.tsx --- .../handlers/instances/instancesHandlers.ts | 37 +++++++++++------- .../ui/src/mocks/handlers/rdi/rdiHandler.ts | 39 ++++++++++++------- .../filter-key-type/FilterKeyType.spec.tsx | 13 ++++--- .../AddDatabaseScreen.spec.tsx | 3 +- .../FetchPipelinePopover.spec.tsx | 16 ++++---- .../template-form/TemplateForm.spec.tsx | 7 ++-- redisinsight/ui/src/utils/test-utils.tsx | 13 +++++++ 7 files changed, 83 insertions(+), 45 deletions(-) diff --git a/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts b/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts index e8eb599a7a..783c9224d5 100644 --- a/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts +++ b/redisinsight/ui/src/mocks/handlers/instances/instancesHandlers.ts @@ -92,19 +92,30 @@ const handlers: HttpHandler[] = [ http.get(getMswURL(`${ApiEndpoints.DATABASES}/:id/connect`), async () => { return HttpResponse.text('', { status: 200 }) }), -] - -// rest.post(`${ApiEndpoints.INSTANCE}`, (req, res, ctx) => { -// const { username } = req.body + http.post< + any, + { + name: string + host: string + port: number + username: string + timeout: number + tls: boolean + }, + Partial + >(getMswURL(`${ApiEndpoints.DATABASES}`), async ({ request }) => { + const { username } = await request.json() -// return res( -// ctx.json({ -// id: 'f79e82e8-c34a-4dc7-a49e-9fadc0979fda', -// username, -// firstName: 'John', -// lastName: 'Maverick', -// }), -// ) -// }), + return HttpResponse.json( + { + id: 'f79e82e8-c34a-4dc7-a49e-9fadc0979fda', + username, + host: 'localhost', + port: 6379, + }, + { status: 201 }, + ) + }), +] export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/rdi/rdiHandler.ts b/redisinsight/ui/src/mocks/handlers/rdi/rdiHandler.ts index e2cf597196..bf85f3ab89 100644 --- a/redisinsight/ui/src/mocks/handlers/rdi/rdiHandler.ts +++ b/redisinsight/ui/src/mocks/handlers/rdi/rdiHandler.ts @@ -2,25 +2,36 @@ import { http, HttpHandler, HttpResponse } from 'msw' import { getMswURL } from 'uiSrc/utils/test-utils' import { getUrl } from 'uiSrc/utils' import { ApiEndpoints } from 'uiSrc/constants' -import { Rdi as RdiInstanceResponse } from 'apiSrc/modules/rdi/models/rdi' const handlers: HttpHandler[] = [ // fetch rdi instances - http.get( - getMswURL(getUrl(ApiEndpoints.RDI_INSTANCES)), + http.get(getMswURL(getUrl(ApiEndpoints.RDI_INSTANCES)), async () => { + return HttpResponse.json( + [ + { + id: '1', + name: 'My first integration', + url: 'redis-12345.c253.us-central1-1.gce.cloud.redislabs.com:12345', + lastConnection: new Date(), + version: '1.2', + type: 'api', + username: 'user', + }, + ], + { status: 200 }, + ) + }), + http.get( + getMswURL(`/${ApiEndpoints.RDI_INSTANCES}/:id/pipeline`), async () => { return HttpResponse.json( - [ - { - id: '1', - name: 'My first integration', - url: 'redis-12345.c253.us-central1-1.gce.cloud.redislabs.com:12345', - lastConnection: new Date(), - version: '1.2', - type: 'api', - username: 'user', - }, - ], + { + jobs: [ + { name: 'job1', value: 'value' }, + { name: 'job2', value: 'value' }, + ], + config: { field: 'value' }, + }, { status: 200 }, ) }, diff --git a/redisinsight/ui/src/pages/browser/components/filter-key-type/FilterKeyType.spec.tsx b/redisinsight/ui/src/pages/browser/components/filter-key-type/FilterKeyType.spec.tsx index b73c20e8b8..5bc3637c6a 100644 --- a/redisinsight/ui/src/pages/browser/components/filter-key-type/FilterKeyType.spec.tsx +++ b/redisinsight/ui/src/pages/browser/components/filter-key-type/FilterKeyType.spec.tsx @@ -2,7 +2,7 @@ import { cloneDeep, set } from 'lodash' import React from 'react' import { cleanup, - clearStoreActions, + expectActionsToContain, fireEvent, initialStateDefault, mockedStore, @@ -68,10 +68,13 @@ describe('FilterKeyType', () => { await userEvent.click(screen.getByTestId(filterSelectId)) await userEvent.click(await findByText('Hash')) - const expectedActions = [setFilter(KeyTypes.Hash), resetBrowserTree(), loadKeys()] - expect(clearStoreActions(store.getActions())).toEqual( - clearStoreActions(expectedActions), - ) + const expectedActions = [ + setFilter(KeyTypes.Hash), + resetBrowserTree(), + loadKeys(), + ] + + expectActionsToContain(store.getActions(), expectedActions) }) it('should be disabled filter with database redis version < 6.0', () => { diff --git a/redisinsight/ui/src/pages/home/components/add-database-screen/AddDatabaseScreen.spec.tsx b/redisinsight/ui/src/pages/home/components/add-database-screen/AddDatabaseScreen.spec.tsx index cb99791219..59d510b202 100644 --- a/redisinsight/ui/src/pages/home/components/add-database-screen/AddDatabaseScreen.spec.tsx +++ b/redisinsight/ui/src/pages/home/components/add-database-screen/AddDatabaseScreen.spec.tsx @@ -8,6 +8,7 @@ import { mockedStore, cleanup, act, + expectActionsToContain, } from 'uiSrc/utils/test-utils' import { defaultInstanceChanging } from 'uiSrc/slices/instances/instances' @@ -35,7 +36,7 @@ describe('AddDatabaseScreen', () => { fireEvent.click(screen.getByTestId('btn-submit')) }) - expect(store.getActions()).toEqual([defaultInstanceChanging()]) + expectActionsToContain(store.getActions(), [defaultInstanceChanging()]) }) it('should disable test connection and submit buttons when connection url is invalid', async () => { diff --git a/redisinsight/ui/src/pages/rdi/instance/components/header/components/fetch-pipeline-popover/FetchPipelinePopover.spec.tsx b/redisinsight/ui/src/pages/rdi/instance/components/header/components/fetch-pipeline-popover/FetchPipelinePopover.spec.tsx index fb16ece451..22b29fb269 100644 --- a/redisinsight/ui/src/pages/rdi/instance/components/header/components/fetch-pipeline-popover/FetchPipelinePopover.spec.tsx +++ b/redisinsight/ui/src/pages/rdi/instance/components/header/components/fetch-pipeline-popover/FetchPipelinePopover.spec.tsx @@ -3,10 +3,12 @@ import { cloneDeep } from 'lodash' import { act, cleanup, + expectActionsToContain, fireEvent, mockedStore, render, screen, + userEvent, } from 'uiSrc/utils/test-utils' import { getPipeline, rdiPipelineSelector } from 'uiSrc/slices/rdi/pipeline' import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry' @@ -57,9 +59,7 @@ describe('FetchPipelinePopover', () => { expect(screen.queryByTestId('confirm-btn')).not.toBeInTheDocument() - await act(() => { - fireEvent.click(screen.getByTestId('upload-pipeline-btn')) - }) + await userEvent.click(screen.getByTestId('upload-pipeline-btn')) expect(screen.queryByTestId('upload-confirm-btn')).toBeInTheDocument() }) @@ -67,16 +67,16 @@ describe('FetchPipelinePopover', () => { it('should call proper actions', async () => { render() - await act(() => { + await act(async () => { fireEvent.click(screen.getByTestId('upload-pipeline-btn')) }) - await act(() => { + await act(async () => { fireEvent.click(screen.getByTestId('upload-confirm-btn')) }) const expectedActions = [getPipeline()] - expect(store.getActions()).toEqual(expectedActions) + expectActionsToContain(store.getActions(), expectedActions) }) it('should call proper telemetry event', async () => { @@ -87,11 +87,11 @@ describe('FetchPipelinePopover', () => { render() - await act(() => { + await act(async () => { fireEvent.click(screen.getByTestId('upload-pipeline-btn')) }) - expect(sendEventTelemetry).toBeCalledWith({ + expect(sendEventTelemetry).toHaveBeenCalledWith({ event: TelemetryEvent.RDI_PIPELINE_UPLOAD_FROM_SERVER_CLICKED, eventData: { id: 'rdiInstanceId', diff --git a/redisinsight/ui/src/pages/rdi/pipeline-management/components/template-form/TemplateForm.spec.tsx b/redisinsight/ui/src/pages/rdi/pipeline-management/components/template-form/TemplateForm.spec.tsx index 75a814d7c4..d0b6d3ce06 100644 --- a/redisinsight/ui/src/pages/rdi/pipeline-management/components/template-form/TemplateForm.spec.tsx +++ b/redisinsight/ui/src/pages/rdi/pipeline-management/components/template-form/TemplateForm.spec.tsx @@ -5,6 +5,7 @@ import { instance, mock } from 'ts-mockito' import { act, cleanup, + expectActionsToContain, fireEvent, mockedStore, render, @@ -66,11 +67,9 @@ describe('TemplateForm', () => { render() }) - const expectedActions = getPipelineStrategies() + const expectedActions = [getPipelineStrategies()] - expect(store.getActions()).toEqual( - expect.arrayContaining([expectedActions]), - ) + expectActionsToContain(store.getActions(), expectedActions) }) it('apply btn should be disabled if there is any value', () => { diff --git a/redisinsight/ui/src/utils/test-utils.tsx b/redisinsight/ui/src/utils/test-utils.tsx index 68af3a6d59..7b1c02303a 100644 --- a/redisinsight/ui/src/utils/test-utils.tsx +++ b/redisinsight/ui/src/utils/test-utils.tsx @@ -442,6 +442,18 @@ export const mockFeatureFlags = ( }) } +/** + * Helper function to check if expected actions are contained within actual store actions + * @param actualActions - The actual actions dispatched to the store + * @param expectedActions - The expected actions that should be present + */ +const expectActionsToContain = ( + actualActions: any[], + expectedActions: any[], +) => { + expect(actualActions).toEqual(expect.arrayContaining(expectedActions)) +} + // re-export everything export * from '@testing-library/react' // override render method @@ -455,4 +467,5 @@ export { waitForRiTooltipVisible, waitForRiTooltipHidden, waitForRiPopoverVisible, + expectActionsToContain, } From feb0f92c4f808a73977f6cc906e3ed40a6520736 Mon Sep 17 00:00:00 2001 From: pd-redis Date: Wed, 29 Oct 2025 15:58:04 +0200 Subject: [PATCH 16/19] fix AssistanceChat.spec.tsx --- .../assistance-chat/AssistanceChat.spec.tsx | 11 +++-- .../mocks/handlers/ai/assistantHandlers.ts | 46 +++++++++++++++++++ .../ui/src/mocks/handlers/ai/index.ts | 5 ++ redisinsight/ui/src/mocks/handlers/index.ts | 2 + 4 files changed, 59 insertions(+), 5 deletions(-) create mode 100644 redisinsight/ui/src/mocks/handlers/ai/assistantHandlers.ts create mode 100644 redisinsight/ui/src/mocks/handlers/ai/index.ts diff --git a/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/assistance-chat/AssistanceChat.spec.tsx b/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/assistance-chat/AssistanceChat.spec.tsx index 72b3887820..21c5c45a43 100644 --- a/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/assistance-chat/AssistanceChat.spec.tsx +++ b/redisinsight/ui/src/components/side-panels/panels/ai-assistant/components/assistance-chat/AssistanceChat.spec.tsx @@ -3,6 +3,7 @@ import { cloneDeep } from 'lodash' import { act, cleanup, + expectActionsToContain, fireEvent, mockedStore, mockedStoreFn, @@ -122,7 +123,7 @@ describe('AssistanceChat', () => { sendQuestion(expect.objectContaining({ content: 'test' })), ]) - expect(sendEventTelemetry).toBeCalledWith({ + expect(sendEventTelemetry).toHaveBeenCalledWith({ event: TelemetryEvent.AI_CHAT_MESSAGE_SENT, eventData: { chat: AiChatType.Assistance, @@ -155,7 +156,7 @@ describe('AssistanceChat', () => { await waitForRiPopoverVisible() - expect(sendEventTelemetry).toBeCalledWith({ + expect(sendEventTelemetry).toHaveBeenCalledWith({ event: TelemetryEvent.AI_CHAT_BOT_TERMS_DISPLAYED, eventData: { chat: AiChatType.Assistance, @@ -167,7 +168,7 @@ describe('AssistanceChat', () => { fireEvent.click(screen.getByTestId('ai-accept-agreements')) }) - expect(sendEventTelemetry).toBeCalledWith({ + expect(sendEventTelemetry).toHaveBeenCalledWith({ event: TelemetryEvent.AI_CHAT_BOT_TERMS_ACCEPTED, eventData: { chat: AiChatType.Assistance, @@ -204,12 +205,12 @@ describe('AssistanceChat', () => { fireEvent.click(screen.getByTestId('ai-chat-restart-confirm')) }) - expect(store.getActions()).toEqual([ + expectActionsToContain(store.getActions(), [ ...afterRenderActions, removeAssistantChatHistory(), ]) - expect(sendEventTelemetry).toBeCalledWith({ + expect(sendEventTelemetry).toHaveBeenCalledWith({ event: TelemetryEvent.AI_CHAT_SESSION_RESTARTED, eventData: { chat: AiChatType.Assistance, diff --git a/redisinsight/ui/src/mocks/handlers/ai/assistantHandlers.ts b/redisinsight/ui/src/mocks/handlers/ai/assistantHandlers.ts new file mode 100644 index 0000000000..bb1b055b47 --- /dev/null +++ b/redisinsight/ui/src/mocks/handlers/ai/assistantHandlers.ts @@ -0,0 +1,46 @@ +import { http, HttpHandler, HttpResponse } from 'msw' +import { ApiEndpoints } from 'uiSrc/constants' +import { getMswURL } from 'uiSrc/utils/test-utils' + +const handlers: HttpHandler[] = [ + http.get<{ id: string }>( + getMswURL(`/${ApiEndpoints.AI_ASSISTANT_CHATS}/:id`), + async ({ params }) => { + const { id } = params + + return HttpResponse.json({ id, messages: [] }, { status: 200 }) + }, + ), + http.post<{ id: string }, { content: string }>( + getMswURL(`/${ApiEndpoints.AI_ASSISTANT_CHATS}/:id/messages`), + async ({ request }) => { + const { content } = await request.json() + + return HttpResponse.json([content], { status: 200 }) + }, + ), + http.post<{ id: string }, { content: string }>( + getMswURL(`/${ApiEndpoints.AI_ASSISTANT_CHATS}`), + async ({ request }) => { + const { content } = await request.json() + + return HttpResponse.json([content], { status: 200 }) + }, + ), + http.delete<{ id: string }>( + getMswURL(`/${ApiEndpoints.AI_ASSISTANT_CHATS}/:id`), + async () => { + return HttpResponse.text('', { status: 200 }) + }, + ), + http.options(getMswURL(`/${ApiEndpoints.AI_ASSISTANT_CHATS}*`), () => { + return new Response(null, { + status: 200, + headers: { + Allow: 'GET,HEAD,POST,DELETE', + }, + }) + }), +] + +export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/ai/index.ts b/redisinsight/ui/src/mocks/handlers/ai/index.ts new file mode 100644 index 0000000000..b69ef1d10e --- /dev/null +++ b/redisinsight/ui/src/mocks/handlers/ai/index.ts @@ -0,0 +1,5 @@ +import { HttpHandler } from 'msw' +import assistant from 'uiSrc/mocks/handlers/ai/assistantHandlers' + +const handlers: HttpHandler[] = [...assistant] +export default handlers diff --git a/redisinsight/ui/src/mocks/handlers/index.ts b/redisinsight/ui/src/mocks/handlers/index.ts index c4de8de4cb..73eb183109 100644 --- a/redisinsight/ui/src/mocks/handlers/index.ts +++ b/redisinsight/ui/src/mocks/handlers/index.ts @@ -9,6 +9,7 @@ import tutorials from './tutorials' import rdi from './rdi' import user from './user' import workbench from './workbench' +import ai from './ai' // @ts-ignore export const handlers = [ @@ -23,4 +24,5 @@ export const handlers = [ ...rdi, ...user, ...workbench, + ...ai, ] From 2d7b6a42b83731b0522bd5a13a3ad30b3e132584 Mon Sep 17 00:00:00 2001 From: pd-redis Date: Wed, 29 Oct 2025 16:03:21 +0200 Subject: [PATCH 17/19] fix OAuthCreateDb.spec.tsx --- .../oauth-sso/oauth-create-db/OAuthCreateDb.spec.tsx | 11 ++++++----- redisinsight/ui/src/mocks/handlers/oauth/cloud.ts | 6 ++++++ 2 files changed, 12 insertions(+), 5 deletions(-) diff --git a/redisinsight/ui/src/components/oauth/oauth-sso/oauth-create-db/OAuthCreateDb.spec.tsx b/redisinsight/ui/src/components/oauth/oauth-sso/oauth-create-db/OAuthCreateDb.spec.tsx index 492aa35d8e..54e43c1798 100644 --- a/redisinsight/ui/src/components/oauth/oauth-sso/oauth-create-db/OAuthCreateDb.spec.tsx +++ b/redisinsight/ui/src/components/oauth/oauth-sso/oauth-create-db/OAuthCreateDb.spec.tsx @@ -3,6 +3,7 @@ import { cloneDeep } from 'lodash' import { act, cleanup, + expectActionsToContain, fireEvent, mockedStore, render, @@ -86,7 +87,7 @@ describe('OAuthCreateDb', () => { expect(screen.getByTestId('sso-email')).toBeInTheDocument() - expect(sendEventTelemetry).toBeCalledWith({ + expect(sendEventTelemetry).toHaveBeenCalledWith({ event: TelemetryEvent.CLOUD_SIGN_IN_SOCIAL_ACCOUNT_SELECTED, eventData: { accountOption: OAuthStrategy.SSO, @@ -107,7 +108,7 @@ describe('OAuthCreateDb', () => { fireEvent.click(screen.getByTestId('btn-submit')) }) - expect(sendEventTelemetry).toBeCalledWith({ + expect(sendEventTelemetry).toHaveBeenCalledWith({ event: TelemetryEvent.CLOUD_SIGN_IN_SSO_OPTION_PROCEEDED, eventData: { action: OAuthSocialAction.Create, @@ -124,7 +125,7 @@ describe('OAuthCreateDb', () => { fireEvent.click(screen.getByTestId('google-oauth')) - expect(sendEventTelemetry).toBeCalledWith({ + expect(sendEventTelemetry).toHaveBeenCalledWith({ event: TelemetryEvent.CLOUD_SIGN_IN_SOCIAL_ACCOUNT_SELECTED, eventData: { accountOption: OAuthStrategy.Google, @@ -174,7 +175,7 @@ describe('OAuthCreateDb', () => { expect(store.getActions()).toEqual(expectedActions) }) - it('should call proper actions after click create without recommened settings', async () => { + it('should call proper actions after click create without recommended settings', async () => { ;(oauthCloudUserSelector as jest.Mock).mockReturnValue({ data: {} }) render() @@ -193,6 +194,6 @@ describe('OAuthCreateDb', () => { setSocialDialogState(null), getPlans(), ] - expect(store.getActions()).toEqual(expectedActions) + expectActionsToContain(store.getActions(), expectedActions) }) }) diff --git a/redisinsight/ui/src/mocks/handlers/oauth/cloud.ts b/redisinsight/ui/src/mocks/handlers/oauth/cloud.ts index cea89dd0ae..178effea0d 100644 --- a/redisinsight/ui/src/mocks/handlers/oauth/cloud.ts +++ b/redisinsight/ui/src/mocks/handlers/oauth/cloud.ts @@ -26,6 +26,12 @@ const handlers: HttpHandler[] = [ http.get(getMswURL(ApiEndpoints.CLOUD_ME), async () => { return HttpResponse.json(CLOUD_ME_DATA_MOCK, { status: 200 }) }), + http.get(getMswURL(ApiEndpoints.CLOUD_SUBSCRIPTION_PLANS), async () => { + return HttpResponse.json(CLOUD_ME_DATA_MOCK, { status: 200 }) + }), + http.post(getMswURL(ApiEndpoints.CLOUD_ME_JOBS), async () => { + return HttpResponse.json(CLOUD_ME_DATA_MOCK, { status: 200 }) + }), ] export default handlers From 9d8a087db92f469aecd45f45d72d0e58338c9a83 Mon Sep 17 00:00:00 2001 From: Artsiom Kharuzhenka Date: Thu, 30 Oct 2025 11:24:26 +0200 Subject: [PATCH 18/19] Fix tests (#5119) * Properly msw server to return success response for unhandled requests temporary Fix store issue in RediSearchIndexesList.spec.tsx * fix the rest tests related to store initialization issue --- .../GlobalUrlHandler.spec.tsx | 37 ++++++----- .../recommendation/Recommendation.spec.tsx | 4 +- .../ConfigOAuth/ConfigOAuth.spec.tsx | 24 ++++--- redisinsight/ui/src/mocks/server.ts | 14 +++- .../RediSearchIndexesList.spec.tsx | 59 ++++++++++------- .../RdiInstancesListWrapper.spec.tsx | 64 ++++++++----------- .../PipelineManagementPage.spec.tsx | 44 ++++++------- .../SourcePipelineModal.spec.tsx | 22 ++++--- .../cloud-settings/CloudSettings.spec.tsx | 18 ++++-- redisinsight/ui/src/setup-tests.ts | 18 +----- redisinsight/ui/src/utils/test-utils.tsx | 5 ++ 11 files changed, 162 insertions(+), 147 deletions(-) diff --git a/redisinsight/ui/src/components/global-url-handler/GlobalUrlHandler.spec.tsx b/redisinsight/ui/src/components/global-url-handler/GlobalUrlHandler.spec.tsx index 3adccc6b33..5412181e8a 100644 --- a/redisinsight/ui/src/components/global-url-handler/GlobalUrlHandler.spec.tsx +++ b/redisinsight/ui/src/components/global-url-handler/GlobalUrlHandler.spec.tsx @@ -1,7 +1,12 @@ import React from 'react' -import { cloneDeep } from 'lodash' import reactRouterDom from 'react-router-dom' -import { act, cleanup, mockedStore, render } from 'uiSrc/utils/test-utils' +import { + act, + cleanup, + createMockedStore, + mockedStore, + render, +} from 'uiSrc/utils/test-utils' import { appRedirectionSelector, @@ -45,13 +50,15 @@ jest.mock('uiSrc/utils/routing', () => ({ let store: typeof mockedStore beforeEach(() => { cleanup() - store = cloneDeep(mockedStore) + store = createMockedStore() store.clearActions() }) const fromUrl = 'redisinsight://databases/connect?redisUrl=redis://default:password@localhost:6379&databaseAlias=My Name&redirect=workbench?guidePath=/quick-guides/document/introduction.md&cloudBdbId=1232&subscriptionType=fixed&planMemoryLimit=30&memoryLimitMeasurementUnit=mb&free=true&target=_blank' +const renderGlobalUrlHandler = () => render(, { store }) + describe('GlobalUrlHandler', () => { beforeEach(() => { reactRouterDom.useLocation = jest @@ -60,11 +67,11 @@ describe('GlobalUrlHandler', () => { }) it('should render', () => { - expect(render()).toBeTruthy() + expect(renderGlobalUrlHandler()).toBeTruthy() }) it('should not call any actions by default', () => { - render() + renderGlobalUrlHandler() expect(store.getActions()).toEqual([]) }) @@ -77,7 +84,7 @@ describe('GlobalUrlHandler', () => { .mockReturnValueOnce({ replace: replaceMock }) reactRouterDom.useLocation = jest.fn().mockReturnValueOnce({ search }) - render() + renderGlobalUrlHandler() expect(store.getActions()).toEqual([ setFromUrl(decodeURIComponent(fromUrl)), ]) @@ -99,7 +106,7 @@ describe('GlobalUrlHandler', () => { ;(appRedirectionSelector as jest.Mock).mockReturnValueOnce({ fromUrl }) await act(async () => { - render() + renderGlobalUrlHandler() }) const actionUrl = new URL(fromUrl) @@ -130,7 +137,7 @@ describe('GlobalUrlHandler', () => { ;(appRedirectionSelector as jest.Mock).mockReturnValueOnce({ fromUrl }) await act(async () => { - render() + renderGlobalUrlHandler() }) const actionUrl = new URL(fromUrl) @@ -158,9 +165,7 @@ describe('GlobalUrlHandler', () => { fromUrl, }) - await act(() => { - render() - }) + renderGlobalUrlHandler() const actionUrl = new URL(fromUrl) const fromParams = new URLSearchParams(actionUrl.search) @@ -194,7 +199,7 @@ describe('GlobalUrlHandler', () => { }) await act(() => { - render() + renderGlobalUrlHandler() }) const actionUrl = new URL(url) @@ -246,7 +251,7 @@ describe('GlobalUrlHandler', () => { }) await act(() => { - render() + renderGlobalUrlHandler() }) const actionUrl = new URL(url) @@ -296,7 +301,7 @@ describe('GlobalUrlHandler', () => { }) await act(() => { - render() + renderGlobalUrlHandler() }) const actionUrl = new URL(url) @@ -347,7 +352,7 @@ describe('GlobalUrlHandler', () => { }) await act(() => { - render() + renderGlobalUrlHandler() }) const actionUrl = new URL(url) @@ -398,7 +403,7 @@ describe('GlobalUrlHandler', () => { }) await act(() => { - render() + renderGlobalUrlHandler() }) const actionUrl = new URL(url) diff --git a/redisinsight/ui/src/components/side-panels/panels/live-time-recommendations/components/recommendation/Recommendation.spec.tsx b/redisinsight/ui/src/components/side-panels/panels/live-time-recommendations/components/recommendation/Recommendation.spec.tsx index a28920a016..2d4b27c9c8 100644 --- a/redisinsight/ui/src/components/side-panels/panels/live-time-recommendations/components/recommendation/Recommendation.spec.tsx +++ b/redisinsight/ui/src/components/side-panels/panels/live-time-recommendations/components/recommendation/Recommendation.spec.tsx @@ -15,7 +15,7 @@ import { } from 'uiSrc/utils/test-utils' import { sendEventTelemetry, TelemetryEvent } from 'uiSrc/telemetry' -import { updateRecommendation } from 'uiSrc/slices/recommendations/recommendations' +import {updateRecommendation, updateRecommendationSuccess} from 'uiSrc/slices/recommendations/recommendations' import { INSTANCE_ID_MOCK } from 'uiSrc/mocks/handlers/instances/instancesHandlers' import { MOCK_RECOMMENDATIONS } from 'uiSrc/constants/mocks/mock-recommendations' import { findTutorialPath } from 'uiSrc/utils' @@ -214,7 +214,7 @@ describe('Recommendation', () => { ) }) - const expectedActions = [updateRecommendation()] + const expectedActions = [updateRecommendation(), updateRecommendationSuccess({})] expect(store.getActions()).toEqual(expectedActions) expect(screen.getByTestId('toggle-hide-searchJSON-btn')).toBeInTheDocument() diff --git a/redisinsight/ui/src/electron/components/ConfigOAuth/ConfigOAuth.spec.tsx b/redisinsight/ui/src/electron/components/ConfigOAuth/ConfigOAuth.spec.tsx index 1b36360e63..173aa7fa7b 100644 --- a/redisinsight/ui/src/electron/components/ConfigOAuth/ConfigOAuth.spec.tsx +++ b/redisinsight/ui/src/electron/components/ConfigOAuth/ConfigOAuth.spec.tsx @@ -1,6 +1,10 @@ import React from 'react' -import { cloneDeep } from 'lodash' -import { cleanup, mockedStore, render } from 'uiSrc/utils/test-utils' +import { + cleanup, + createMockedStore, + mockedStore, + render, +} from 'uiSrc/utils/test-utils' import { CloudAuthStatus, @@ -48,13 +52,17 @@ jest.mock('uiSrc/slices/instances/cloud', () => ({ let store: typeof mockedStore beforeEach(() => { cleanup() - store = cloneDeep(mockedStore) + store = createMockedStore() store.clearActions() window.app = { cloudOauthCallback: jest.fn(), } as any }) +const renderConfigOAuth = () => { + return render(, { store }) +} + describe('ConfigOAuth', () => { it('should render', () => { expect(render()).toBeTruthy() @@ -68,7 +76,7 @@ describe('ConfigOAuth', () => { window.app?.cloudOauthCallback.mockImplementation((cb: any) => cb(undefined, { status: CloudAuthStatus.Succeed }), ) - render() + renderConfigOAuth() const expectedActions = [ setJob({ @@ -95,7 +103,7 @@ describe('ConfigOAuth', () => { error: 'error', }), ) - render() + renderConfigOAuth() const expectedActions = [ setOAuthCloudSource(null), @@ -127,7 +135,7 @@ describe('ConfigOAuth', () => { window.app?.cloudOauthCallback.mockImplementation((cb: any) => cb(undefined, { status: CloudAuthStatus.Succeed }), ) - render() + renderConfigOAuth() const afterCallbackActions = [ setJob({ @@ -165,7 +173,7 @@ describe('ConfigOAuth', () => { window.app?.cloudOauthCallback.mockImplementation((cb: any) => cb(undefined, { status: CloudAuthStatus.Succeed }), ) - render() + renderConfigOAuth() const afterCallbackActions = [ setJob({ @@ -204,7 +212,7 @@ describe('ConfigOAuth', () => { window.app?.cloudOauthCallback.mockImplementation((cb: any) => cb(undefined, { status: CloudAuthStatus.Succeed }), ) - render() + renderConfigOAuth() const afterCallbackActions = [ setJob({ diff --git a/redisinsight/ui/src/mocks/server.ts b/redisinsight/ui/src/mocks/server.ts index ada76a1ced..7df6b7a00b 100644 --- a/redisinsight/ui/src/mocks/server.ts +++ b/redisinsight/ui/src/mocks/server.ts @@ -1,5 +1,17 @@ import { setupServer } from 'msw/node' +import { http, HttpResponse } from 'msw' import { handlers } from './handlers' // Setup requests interception using the given handlers. -export const mswServer = setupServer(...handlers) +export const mswServer = setupServer( + ...handlers, + http.all( + '*', + jest + .fn() + .mockImplementation(async ({ request }) => { + console.warn(`[MSW] Unhandled request: ${request.method} ${request.url}`) + return HttpResponse.json({}, { status: 200 }) + }), + ), +) diff --git a/redisinsight/ui/src/pages/browser/components/redisearch-key-list/RediSearchIndexesList.spec.tsx b/redisinsight/ui/src/pages/browser/components/redisearch-key-list/RediSearchIndexesList.spec.tsx index 516b5c50d8..43a9a08f63 100644 --- a/redisinsight/ui/src/pages/browser/components/redisearch-key-list/RediSearchIndexesList.spec.tsx +++ b/redisinsight/ui/src/pages/browser/components/redisearch-key-list/RediSearchIndexesList.spec.tsx @@ -1,4 +1,4 @@ -import { cloneDeep } from 'lodash' +import { merge } from 'lodash' import React from 'react' import { instance, mock } from 'ts-mockito' import { useSelector } from 'react-redux' @@ -7,13 +7,16 @@ import { cleanup, clearStoreActions, fireEvent, + initialStateDefault, mockedStore, + mockStore, render, screen, userEvent, } from 'uiSrc/utils/test-utils' import { loadList, + loadListSuccess, redisearchListSelector, setSelectedIndex, } from 'uiSrc/slices/browser/redisearch' @@ -25,11 +28,25 @@ import { connectedInstanceSelector } from 'uiSrc/slices/instances/instances' import { changeSearchMode, fetchKeys } from 'uiSrc/slices/browser/keys' import { BrowserStorageItem } from 'uiSrc/constants' import RediSearchIndexesList, { Props } from './RediSearchIndexesList' +import { INSTANCE_ID_MOCK } from 'uiSrc/mocks/handlers/instances/instancesHandlers' +import { setStoreRef } from 'uiSrc/utils/test-store' +import { REDISEARCH_LIST_DATA_MOCK } from 'uiSrc/mocks/handlers/browser/redisearchHandlers' let store: typeof mockedStore beforeEach(() => { cleanup() - store = cloneDeep(mockedStore) + store = mockStore( + merge({}, initialStateDefault, { + connections: { + instances: { + connectedInstance: { + id: INSTANCE_ID_MOCK, + }, + }, + }, + }), + ) + setStoreRef(store) store.clearActions() }) @@ -74,6 +91,10 @@ jest.mock('uiSrc/services', () => ({ }, })) +const renderRediSearchIndexesList = (props: Props) => { + return render(, { store }) +} + describe('RediSearchIndexesList', () => { beforeEach(() => { const state: any = store.getState() @@ -109,9 +130,7 @@ describe('RediSearchIndexesList', () => { }) it('should render', () => { - expect( - render(), - ).toBeTruthy() + expect(renderRediSearchIndexesList(instance(mockedProps))).toBeTruthy() const searchInput = screen.getByTestId('select-search-mode') expect(searchInput).toBeInTheDocument() }) @@ -123,9 +142,7 @@ describe('RediSearchIndexesList', () => { modules: [], })) - expect( - render(), - ).toBeTruthy() + expect(renderRediSearchIndexesList(instance(mockedProps))).toBeTruthy() const expectedActions = [ changeSearchMode(SearchMode.Pattern), @@ -143,9 +160,7 @@ describe('RediSearchIndexesList', () => { }) it('"loadList" should be called after render', () => { - const { rerender } = render( - , - ) + const { rerender } = renderRediSearchIndexesList(instance(mockedProps)) ;(connectedInstanceSelector as jest.Mock).mockImplementation(() => ({ host: '123.23.1.1', @@ -162,12 +177,10 @@ describe('RediSearchIndexesList', () => { it('"onCreateIndex" should be called after click Create Index', async () => { const onCreateIndexMock = jest.fn() - const { findByText } = render( - , - ) + const { findByText } = renderRediSearchIndexesList({ + ...instance(mockedProps), + onCreateIndex: onCreateIndexMock, + }) await userEvent.click(screen.getByTestId('select-search-mode')) await userEvent.click((await findByText('Create Index')) || document) @@ -187,9 +200,7 @@ describe('RediSearchIndexesList', () => { selectedIndex: null, }) - const { queryByText } = render( - , - ) + const { queryByText } = renderRediSearchIndexesList(instance(mockedProps)) ;(connectedInstanceSelector as jest.Mock).mockImplementation(() => ({ host: '123.123.1.1', @@ -199,7 +210,11 @@ describe('RediSearchIndexesList', () => { await userEvent.click(screen.getByTestId('select-search-mode')) await userEvent.click(queryByText(bufferToString(index)) || document) - const expectedActions = [setSelectedIndex(index), loadList()] + const expectedActions = [ + setSelectedIndex(index), + loadList(), + loadListSuccess(REDISEARCH_LIST_DATA_MOCK.indexes), + ] expect(clearStoreActions(store.getActions())).toEqual( clearStoreActions(expectedActions), @@ -214,7 +229,7 @@ describe('RediSearchIndexesList', () => { modules: [{ name: RedisDefaultModules.Search }], })) - render() + renderRediSearchIndexesList(instance(mockedProps)) const afterRenderActions = [...store.getActions()] diff --git a/redisinsight/ui/src/pages/rdi/home/instance-list/RdiInstancesListWrapper.spec.tsx b/redisinsight/ui/src/pages/rdi/home/instance-list/RdiInstancesListWrapper.spec.tsx index 4bc3e2032b..734bc01319 100644 --- a/redisinsight/ui/src/pages/rdi/home/instance-list/RdiInstancesListWrapper.spec.tsx +++ b/redisinsight/ui/src/pages/rdi/home/instance-list/RdiInstancesListWrapper.spec.tsx @@ -1,7 +1,6 @@ import { EuiInMemoryTable } from '@elastic/eui' import React from 'react' import { instance, mock } from 'ts-mockito' -import { cloneDeep } from 'lodash' import ItemList, { Props as ItemListProps, @@ -9,17 +8,17 @@ import ItemList, { import { RdiInstance } from 'uiSrc/slices/interfaces' import { TelemetryEvent, sendEventTelemetry } from 'uiSrc/telemetry' import { - act, cleanup, - fireEvent, + createMockedStore, mockedStore, render, screen, + userEvent, } from 'uiSrc/utils/test-utils' import { - resetConnectedInstance, setDefaultInstance, + setDefaultInstanceSuccess, } from 'uiSrc/slices/rdi/instances' import RdiInstancesListWrapper, { Props } from './RdiInstancesListWrapper' @@ -115,19 +114,20 @@ const mockRdiInstancesList = (props: ItemListProps) => { let store: typeof mockedStore beforeEach(() => { cleanup() - store = cloneDeep(mockedStore) + store = createMockedStore() store.clearActions() }) +const renderRdiInstancesListWrapper = (props: Props) => + render(, { store }) + describe('RdiInstancesListWrapper', () => { beforeAll(() => { ;(ItemList as jest.Mock).mockImplementation(mockRdiInstancesList) }) it('should render', () => { - expect( - render(), - ).toBeTruthy() + expect(renderRdiInstancesListWrapper(instance(mockedProps))).toBeTruthy() }) it('should call proper telemetry on delete multiple instances', async () => { @@ -135,11 +135,9 @@ describe('RdiInstancesListWrapper', () => { ;(sendEventTelemetry as jest.Mock).mockImplementation( () => sendEventTelemetryMock, ) - render() + renderRdiInstancesListWrapper(instance(mockedProps)) - await act(() => { - fireEvent.click(screen.getByTestId('onDelete-btn')) - }) + await userEvent.click(screen.getByTestId('onDelete-btn')) expect(sendEventTelemetry).toBeCalledWith({ event: TelemetryEvent.RDI_INSTANCE_MULTIPLE_DELETE_CLICKED, @@ -151,13 +149,11 @@ describe('RdiInstancesListWrapper', () => { }) it('should call proper action on rdi alias click', async () => { - render() + renderRdiInstancesListWrapper(instance(mockedProps)) - await act(() => { - fireEvent.click(screen.getByTestId('rdi-alias-1')) - }) + await userEvent.click(screen.getByTestId('rdi-alias-1')) - const expectedActions = [setDefaultInstance()] + const expectedActions = [setDefaultInstance(), setDefaultInstanceSuccess()] expect(store.getActions()).toEqual(expectedActions) }) @@ -167,12 +163,10 @@ describe('RdiInstancesListWrapper', () => { ;(sendEventTelemetry as jest.Mock).mockImplementation( () => sendEventTelemetryMock, ) - render() + renderRdiInstancesListWrapper(instance(mockedProps)) - await act(() => { - const copyHostPortButtons = screen.getAllByLabelText(/Copy url/i) - fireEvent.click(copyHostPortButtons[0]) - }) + const copyHostPortButtons = screen.getAllByLabelText(/Copy url/i) + await userEvent.click(copyHostPortButtons[0]) expect(sendEventTelemetry).toBeCalledWith({ event: TelemetryEvent.RDI_INSTANCE_URL_COPIED, @@ -188,11 +182,9 @@ describe('RdiInstancesListWrapper', () => { ;(sendEventTelemetry as jest.Mock).mockImplementation( () => sendEventTelemetryMock, ) - render() + renderRdiInstancesListWrapper(instance(mockedProps)) - await act(() => { - fireEvent.click(screen.getByTestId('delete-instance-2-icon')) - }) + await userEvent.click(screen.getByTestId('delete-instance-2-icon')) expect(sendEventTelemetry).toBeCalledWith({ event: TelemetryEvent.RDI_INSTANCE_SINGLE_DELETE_CLICKED, @@ -208,17 +200,13 @@ describe('RdiInstancesListWrapper', () => { ;(sendEventTelemetry as jest.Mock).mockImplementation( () => sendEventTelemetryMock, ) - render( - {}} - />, - ) - - await act(() => { - fireEvent.click(screen.getByTestId('onTableChange-btn')) + renderRdiInstancesListWrapper({ + ...instance(mockedProps), + onEditInstance: () => {}, }) + await userEvent.click(screen.getByTestId('onTableChange-btn')) + expect(sendEventTelemetry).toBeCalledWith({ event: TelemetryEvent.RDI_INSTANCE_LIST_SORTED, eventData: { field: 'name', direction: 'asc' }, @@ -231,11 +219,9 @@ describe('RdiInstancesListWrapper', () => { ;(sendEventTelemetry as jest.Mock).mockImplementation( () => sendEventTelemetryMock, ) - render() + renderRdiInstancesListWrapper(instance(mockedProps)) - await act(() => { - fireEvent.click(screen.getByTestId('rdi-alias-1')) - }) + await userEvent.click(screen.getByTestId('rdi-alias-1')) expect(sendEventTelemetry).toBeCalledWith({ event: TelemetryEvent.OPEN_RDI_CLICKED, diff --git a/redisinsight/ui/src/pages/rdi/pipeline-management/PipelineManagementPage.spec.tsx b/redisinsight/ui/src/pages/rdi/pipeline-management/PipelineManagementPage.spec.tsx index b91809ba89..f4a7524479 100644 --- a/redisinsight/ui/src/pages/rdi/pipeline-management/PipelineManagementPage.spec.tsx +++ b/redisinsight/ui/src/pages/rdi/pipeline-management/PipelineManagementPage.spec.tsx @@ -1,10 +1,14 @@ import React from 'react' -import { cloneDeep } from 'lodash' import reactRouterDom, { BrowserRouter } from 'react-router-dom' import { instance, mock } from 'ts-mockito' import { useFormikContext } from 'formik' -import { render, cleanup, mockedStore } from 'uiSrc/utils/test-utils' +import { + render, + cleanup, + mockedStore, + createMockedStore, +} from 'uiSrc/utils/test-utils' import { appContextPipelineManagement, setLastPageContext, @@ -29,10 +33,18 @@ jest.mock('formik') let store: typeof mockedStore beforeEach(() => { cleanup() - store = cloneDeep(mockedStore) + store = createMockedStore() store.clearActions() }) +const renderPipelineManagement = (props: Props) => + render( + + + , + { store }, + ) + describe('PipelineManagementPage', () => { beforeEach(() => { const mockUseFormikContext = { @@ -43,13 +55,7 @@ describe('PipelineManagementPage', () => { }) it('should render', () => { - expect( - render( - - - , - ), - ).toBeTruthy() + expect(renderPipelineManagement(instance(mockedProps))).toBeTruthy() }) it('should redirect to the config tab by default', () => { @@ -59,11 +65,7 @@ describe('PipelineManagementPage', () => { pathname: Pages.rdiPipelineManagement('rdiInstanceId'), }) - render( - - - , - ) + renderPipelineManagement(instance(mockedProps)) expect(pushMock).toBeCalledWith(Pages.rdiPipelineConfig('rdiInstanceId')) }) @@ -78,11 +80,7 @@ describe('PipelineManagementPage', () => { pathname: Pages.rdiPipelineManagement('rdiInstanceId'), }) - render( - - - , - ) + renderPipelineManagement(instance(mockedProps)) expect(pushMock).toBeCalledWith(Pages.rdiPipelineConfig('rdiInstanceId')) }) @@ -92,11 +90,7 @@ describe('PipelineManagementPage', () => { .fn() .mockReturnValue({ pathname: Pages.rdiPipelineConfig('rdiInstanceId') }) - const { unmount } = render( - - - , - ) + const { unmount } = renderPipelineManagement(instance(mockedProps)) unmount() const expectedActions = [ diff --git a/redisinsight/ui/src/pages/rdi/pipeline-management/components/source-pipeline-dialog/SourcePipelineModal.spec.tsx b/redisinsight/ui/src/pages/rdi/pipeline-management/components/source-pipeline-dialog/SourcePipelineModal.spec.tsx index a2c7b605a5..2822c3e50d 100644 --- a/redisinsight/ui/src/pages/rdi/pipeline-management/components/source-pipeline-dialog/SourcePipelineModal.spec.tsx +++ b/redisinsight/ui/src/pages/rdi/pipeline-management/components/source-pipeline-dialog/SourcePipelineModal.spec.tsx @@ -6,7 +6,7 @@ import { render, fireEvent, screen, - initialStateDefault, + initialStateDefault, createMockedStore, } from 'uiSrc/utils/test-utils' import { getPipeline, @@ -69,7 +69,7 @@ jest.mock('uiSrc/components/base/display', () => { let store: typeof mockedStore beforeEach(() => { cleanup() - store = cloneDeep(mockedStore) + store = createMockedStore() store.clearActions() ;(rdiPipelineSelector as jest.Mock).mockReturnValue({ ...initialStateDefault.rdi.pipeline, @@ -79,9 +79,11 @@ beforeEach(() => { }) }) +const renderSourcePipelineDialog = () => render(, { store }) + describe('SourcePipelineDialog', () => { it('should not show dialog by default and not set isOpenDialog to true', () => { - render() + renderSourcePipelineDialog() expect( screen.queryByTestId('file-source-pipeline-dialog'), @@ -96,7 +98,7 @@ describe('SourcePipelineDialog', () => { isOpenDialog: true, }) - render() + renderSourcePipelineDialog() expect( screen.queryByTestId('file-source-pipeline-dialog'), @@ -110,7 +112,7 @@ describe('SourcePipelineDialog', () => { data: { config: 'some config' }, }) - render() + renderSourcePipelineDialog() expect(store.getActions()).toEqual([]) }) @@ -122,7 +124,7 @@ describe('SourcePipelineDialog', () => { data: null, }) - render() + renderSourcePipelineDialog() expect(store.getActions()).toEqual([]) }) @@ -134,7 +136,7 @@ describe('SourcePipelineDialog', () => { data: { config: '' }, }) - render() + renderSourcePipelineDialog() expect(store.getActions()).toEqual([setPipelineDialogState(true)]) }) @@ -153,7 +155,7 @@ describe('SourcePipelineDialog', () => { }) it('should call proper actions after select fetch from server option', () => { - render() + renderSourcePipelineDialog() fireEvent.click(screen.getByTestId('server-source-pipeline-dialog')) @@ -170,7 +172,7 @@ describe('SourcePipelineDialog', () => { }) it('should call proper actions after select empty pipeline option', () => { - render() + renderSourcePipelineDialog() fireEvent.click(screen.getByTestId('empty-source-pipeline-dialog')) @@ -199,7 +201,7 @@ describe('SourcePipelineDialog', () => { isOpenDialog: true, }) - render() + renderSourcePipelineDialog() fireEvent.click(screen.getByTestId('file-source-pipeline-dialog')) diff --git a/redisinsight/ui/src/pages/settings/components/cloud-settings/CloudSettings.spec.tsx b/redisinsight/ui/src/pages/settings/components/cloud-settings/CloudSettings.spec.tsx index 824863e637..32c2f226bd 100644 --- a/redisinsight/ui/src/pages/settings/components/cloud-settings/CloudSettings.spec.tsx +++ b/redisinsight/ui/src/pages/settings/components/cloud-settings/CloudSettings.spec.tsx @@ -1,8 +1,8 @@ import React from 'react' -import { cloneDeep } from 'lodash' import { act, cleanup, + createMockedStore, fireEvent, mockedStore, render, @@ -34,7 +34,7 @@ jest.mock('uiSrc/slices/oauth/cloud', () => ({ let store: typeof mockedStore beforeEach(() => { cleanup() - store = cloneDeep(mockedStore) + store = createMockedStore() store.clearActions() }) @@ -43,13 +43,17 @@ jest.mock('uiSrc/telemetry', () => ({ sendEventTelemetry: jest.fn(), })) +const renderCloudSettings = () => { + return render(, { store }) +} + describe('CloudSettings', () => { it('should show delete popover and call proper action on delete', async () => { ;(oauthCapiKeysSelector as jest.Mock).mockReturnValue({ data: OAUTH_CLOUD_CAPI_KEYS_DATA, loading: false, }) - render() + renderCloudSettings() await userEvent.click(screen.getByTestId('delete-key-btn')) await waitForRiPopoverVisible() @@ -64,11 +68,11 @@ describe('CloudSettings', () => { }) it('should render', () => { - expect(render()).toBeTruthy() + expect(renderCloudSettings()).toBeTruthy() }) it('should get api keys after render', () => { - render() + renderCloudSettings() expect(store.getActions()).toEqual([getCapiKeys()]) }) @@ -79,7 +83,7 @@ describe('CloudSettings', () => { loading: false, }) - render() + renderCloudSettings() expect(screen.getByTestId('delete-key-btn')).toBeDisabled() }) @@ -92,7 +96,7 @@ describe('CloudSettings', () => { data: OAUTH_CLOUD_CAPI_KEYS_DATA, loading: false, }) - render() + renderCloudSettings() fireEvent.click(screen.getByTestId('delete-key-btn')) await waitForRiPopoverVisible() diff --git a/redisinsight/ui/src/setup-tests.ts b/redisinsight/ui/src/setup-tests.ts index 213bcbf319..0d03910326 100644 --- a/redisinsight/ui/src/setup-tests.ts +++ b/redisinsight/ui/src/setup-tests.ts @@ -41,24 +41,8 @@ Object.defineProperty(window, 'File', { }) beforeAll(() => { - // mswServer.listen() mswServer.listen({ - onUnhandledRequest: ((req: any, res: any, ctx: any) => { - const url = req.url.href - const method = req.method - const testName = expect.getState()?.currentTestName ?? 'unknown test' - - // Log it nicely - console.warn(`[MSW][${testName}] Unhandled request: ${method} ${url}`) - - // throw to fail the test??? - // tmp: just return empty object to fix libuv error. - // todo: need to find all unhandled requests and probably throw right from here and close socket - return res( - ctx.status(200), - ctx.json({}) - ) - }) as any, + onUnhandledRequest: 'bypass' }) }) diff --git a/redisinsight/ui/src/utils/test-utils.tsx b/redisinsight/ui/src/utils/test-utils.tsx index 7b1c02303a..0bd9a3dca7 100644 --- a/redisinsight/ui/src/utils/test-utils.tsx +++ b/redisinsight/ui/src/utils/test-utils.tsx @@ -168,6 +168,11 @@ const initialStateDefault: RootState = { export const mockStore = configureMockStore([thunk]) export const mockedStore = mockStore(initialStateDefault) export const mockedStoreFn = () => mockStore(initialStateDefault) +export const createMockedStore = () => { + const store = mockStore(initialStateDefault) + setStoreRef(store) + return store +} // Set the mock store reference for the dynamic store wrapper // This ensures that store-dynamic works correctly in tests From 59098edd5aff7e2343ea574f459cbf57bd50beac Mon Sep 17 00:00:00 2001 From: pd-redis Date: Thu, 30 Oct 2025 13:00:37 +0200 Subject: [PATCH 19/19] fix DbStatus.spec.tsx --- .../home/components/db-status/DbStatus.spec.tsx | 16 +++++++++++++++- .../pages/home/components/db-status/DbStatus.tsx | 5 ++++- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/redisinsight/ui/src/pages/home/components/db-status/DbStatus.spec.tsx b/redisinsight/ui/src/pages/home/components/db-status/DbStatus.spec.tsx index 022736c619..a93689d4ab 100644 --- a/redisinsight/ui/src/pages/home/components/db-status/DbStatus.spec.tsx +++ b/redisinsight/ui/src/pages/home/components/db-status/DbStatus.spec.tsx @@ -18,8 +18,22 @@ jest.mock('uiSrc/telemetry', () => ({ const mockedProps = mock() const daysToMs = (days: number) => days * 60 * 60 * 24 * 1000 +let mockDate: Date describe('DbStatus', () => { + beforeEach(() => { + jest.clearAllMocks() + + // Set up fake timers + jest.useFakeTimers() + mockDate = new Date('2024-11-22T12:00:00Z') + jest.setSystemTime(mockDate) + }) + + afterEach(() => { + jest.useRealTimers() + }) + it('should render', () => { expect(render()).toBeTruthy() }) @@ -108,7 +122,7 @@ describe('DbStatus', () => { await waitForRiTooltipVisible(1_000) - expect(sendEventTelemetry).toBeCalledWith({ + expect(sendEventTelemetry).toHaveBeenCalledWith({ event: TelemetryEvent.CLOUD_NOT_USED_DB_NOTIFICATION_VIEWED, eventData: { capability: expect.any(String), diff --git a/redisinsight/ui/src/pages/home/components/db-status/DbStatus.tsx b/redisinsight/ui/src/pages/home/components/db-status/DbStatus.tsx index 45312c3e9b..d6768e97fe 100644 --- a/redisinsight/ui/src/pages/home/components/db-status/DbStatus.tsx +++ b/redisinsight/ui/src/pages/home/components/db-status/DbStatus.tsx @@ -88,7 +88,10 @@ const DbStatus = (props: Props) => { ) if (isFree && daysDiff >= LAST_CONNECTION_L) { - return renderWarningTooltip(CHECK_CLOUD_DATABASE, 'checkIfDeleted') + return renderWarningTooltip( + CHECK_CLOUD_DATABASE, + WarningTypes.CheckIfDeleted, + ) } if (isFree && daysDiff >= LAST_CONNECTION_SM) {