From dc180f7468844e5554129a9b3e2f7da512cb0d1b Mon Sep 17 00:00:00 2001 From: Otabek Narzullaev Date: Wed, 27 Nov 2024 18:07:59 +0500 Subject: [PATCH 01/13] chore: remove @ikscodes/browser-env --- jest.config.ts | 14 +- package.json | 8 +- packages/magic-sdk/test/setup.ts | 3 - yarn.lock | 2335 +++++++++++++++--------------- 4 files changed, 1145 insertions(+), 1215 deletions(-) diff --git a/jest.config.ts b/jest.config.ts index 1c0c14ae2..359f43456 100644 --- a/jest.config.ts +++ b/jest.config.ts @@ -7,6 +7,7 @@ const config: Config.InitialOptions = { collectCoverageFrom: ['./src/**/*.{ts,tsx,}'], collectCoverage: true, testTimeout: 30000, // 30s + testEnvironment: 'jsdom', coverageThreshold: { global: { lines: 99, @@ -16,11 +17,14 @@ const config: Config.InitialOptions = { }, }, setupFilesAfterEnv: ['./test/setup.ts'], - globals: { - 'ts-jest': { - tsconfig: './test/tsconfig.json', - isolatedModules: true, - }, + transform: { + '^.+\\.tsx?$': [ + 'ts-jest', + { + tsconfig: './test/tsconfig.json', + isolatedModules: true, + }, + ], }, }; diff --git a/package.json b/package.json index 22f281185..50f5846c2 100644 --- a/package.json +++ b/package.json @@ -17,12 +17,11 @@ "@eslint/compat": "^1.2.2", "@eslint/eslintrc": "^3.1.0", "@eslint/js": "^9.14.0", - "@ikscodes/browser-env": "~0.3.1", "@istanbuljs/nyc-config-typescript": "~0.1.3", "@types/fs-extra": "^9.0.13", "@types/inquirer": "^8.1.1", "@types/is-ci": "^3.0.0", - "@types/jest": "^27.0.0", + "@types/jest": "^29.5.11", "@types/jsdom": "~12.2.4", "@types/lodash": "^4.14.172", "@types/react": "^18.0.26", @@ -53,7 +52,8 @@ "husky": "^7.0.1", "inquirer": "^8.1.2", "is-ci": "^3.0.0", - "jest": "^27.0.6", + "jest": "^29.7.0", + "jest-environment-jsdom": "^29.7.0", "lerna": "8.0.2", "lint-staged": "^10.0.7", "lodash": "^4.17.21", @@ -69,7 +69,7 @@ "regenerator-runtime": "0.13.9", "replace-in-file": "^6.1.0", "rimraf": "~3.0.2", - "ts-jest": "^27.0.4", + "ts-jest": "^29.1.4", "ts-node": "^10.2.0", "tsc-watch": "^4.2.9", "tslib": "^2.3.1", diff --git a/packages/magic-sdk/test/setup.ts b/packages/magic-sdk/test/setup.ts index da7d20ba2..c90a17df4 100644 --- a/packages/magic-sdk/test/setup.ts +++ b/packages/magic-sdk/test/setup.ts @@ -2,11 +2,8 @@ import 'regenerator-runtime/runtime'; -import browserEnv from '@ikscodes/browser-env'; import { mockConsole } from '../../../scripts/utils/mock-console'; -browserEnv(); - beforeEach(() => { mockConsole(); }); diff --git a/yarn.lock b/yarn.lock index c38671188..207eb0de6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -174,6 +174,17 @@ __metadata: languageName: node linkType: hard +"@babel/code-frame@npm:^7.25.9, @babel/code-frame@npm:^7.26.0": + version: 7.26.2 + resolution: "@babel/code-frame@npm:7.26.2" + dependencies: + "@babel/helper-validator-identifier": ^7.25.9 + js-tokens: ^4.0.0 + picocolors: ^1.0.0 + checksum: db13f5c42d54b76c1480916485e6900748bbcb0014a8aca87f50a091f70ff4e0d0a6db63cade75eb41fcc3d2b6ba0a7f89e343def4f96f00269b41b8ab8dd7b8 + languageName: node + linkType: hard + "@babel/compat-data@npm:^7.17.7, @babel/compat-data@npm:^7.20.5": version: 7.21.0 resolution: "@babel/compat-data@npm:7.21.0" @@ -181,7 +192,14 @@ __metadata: languageName: node linkType: hard -"@babel/core@npm:^7.0.0, @babel/core@npm:^7.1.0, @babel/core@npm:^7.12.3, @babel/core@npm:^7.14.0, @babel/core@npm:^7.15.0, @babel/core@npm:^7.7.2, @babel/core@npm:^7.8.0, @babel/core@npm:^7.9.6": +"@babel/compat-data@npm:^7.25.9": + version: 7.26.2 + resolution: "@babel/compat-data@npm:7.26.2" + checksum: d52fae9b0dc59b409d6005ae6b172e89329f46d68136130065ebe923a156fc633e0f1c8600b3e319b9e0f99fd948f64991a5419e2e9431d00d9d235d5f7a7618 + languageName: node + linkType: hard + +"@babel/core@npm:^7.0.0, @babel/core@npm:^7.1.0, @babel/core@npm:^7.12.3, @babel/core@npm:^7.14.0, @babel/core@npm:^7.15.0, @babel/core@npm:^7.9.6": version: 7.21.0 resolution: "@babel/core@npm:7.21.0" dependencies: @@ -204,6 +222,29 @@ __metadata: languageName: node linkType: hard +"@babel/core@npm:^7.11.6, @babel/core@npm:^7.23.9": + version: 7.26.0 + resolution: "@babel/core@npm:7.26.0" + dependencies: + "@ampproject/remapping": ^2.2.0 + "@babel/code-frame": ^7.26.0 + "@babel/generator": ^7.26.0 + "@babel/helper-compilation-targets": ^7.25.9 + "@babel/helper-module-transforms": ^7.26.0 + "@babel/helpers": ^7.26.0 + "@babel/parser": ^7.26.0 + "@babel/template": ^7.25.9 + "@babel/traverse": ^7.25.9 + "@babel/types": ^7.26.0 + convert-source-map: ^2.0.0 + debug: ^4.1.0 + gensync: ^1.0.0-beta.2 + json5: ^2.2.3 + semver: ^6.3.1 + checksum: b296084cfd818bed8079526af93b5dfa0ba70282532d2132caf71d4060ab190ba26d3184832a45accd82c3c54016985a4109ab9118674347a7e5e9bc464894e6 + languageName: node + linkType: hard + "@babel/generator@npm:^7.21.0, @babel/generator@npm:^7.21.1, @babel/generator@npm:^7.4.0, @babel/generator@npm:^7.5.0, @babel/generator@npm:^7.7.2": version: 7.21.1 resolution: "@babel/generator@npm:7.21.1" @@ -216,6 +257,19 @@ __metadata: languageName: node linkType: hard +"@babel/generator@npm:^7.25.9, @babel/generator@npm:^7.26.0": + version: 7.26.2 + resolution: "@babel/generator@npm:7.26.2" + dependencies: + "@babel/parser": ^7.26.2 + "@babel/types": ^7.26.0 + "@jridgewell/gen-mapping": ^0.3.5 + "@jridgewell/trace-mapping": ^0.3.25 + jsesc: ^3.0.2 + checksum: 6ff850b7d6082619f8c2f518d993cf7254cfbaa20b026282cbef5c9b2197686d076a432b18e36c4d1a42721c016df4f77a8f62c67600775d9683621d534b91b4 + languageName: node + linkType: hard + "@babel/helper-annotate-as-pure@npm:^7.18.6": version: 7.18.6 resolution: "@babel/helper-annotate-as-pure@npm:7.18.6" @@ -250,6 +304,19 @@ __metadata: languageName: node linkType: hard +"@babel/helper-compilation-targets@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/helper-compilation-targets@npm:7.25.9" + dependencies: + "@babel/compat-data": ^7.25.9 + "@babel/helper-validator-option": ^7.25.9 + browserslist: ^4.24.0 + lru-cache: ^5.1.1 + semver: ^6.3.1 + checksum: 3af536e2db358b38f968abdf7d512d425d1018fef2f485d6f131a57a7bcaed32c606b4e148bb230e1508fa42b5b2ac281855a68eb78270f54698c48a83201b9b + languageName: node + linkType: hard + "@babel/helper-create-class-features-plugin@npm:^7.18.6, @babel/helper-create-class-features-plugin@npm:^7.21.0": version: 7.21.0 resolution: "@babel/helper-create-class-features-plugin@npm:7.21.0" @@ -349,6 +416,16 @@ __metadata: languageName: node linkType: hard +"@babel/helper-module-imports@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/helper-module-imports@npm:7.25.9" + dependencies: + "@babel/traverse": ^7.25.9 + "@babel/types": ^7.25.9 + checksum: 1b411ce4ca825422ef7065dffae7d8acef52023e51ad096351e3e2c05837e9bf9fca2af9ca7f28dc26d596a588863d0fedd40711a88e350b736c619a80e704e6 + languageName: node + linkType: hard + "@babel/helper-module-transforms@npm:^7.21.0, @babel/helper-module-transforms@npm:^7.21.2": version: 7.21.2 resolution: "@babel/helper-module-transforms@npm:7.21.2" @@ -365,6 +442,19 @@ __metadata: languageName: node linkType: hard +"@babel/helper-module-transforms@npm:^7.26.0": + version: 7.26.0 + resolution: "@babel/helper-module-transforms@npm:7.26.0" + dependencies: + "@babel/helper-module-imports": ^7.25.9 + "@babel/helper-validator-identifier": ^7.25.9 + "@babel/traverse": ^7.25.9 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: 942eee3adf2b387443c247a2c190c17c4fd45ba92a23087abab4c804f40541790d51ad5277e4b5b1ed8d5ba5b62de73857446b7742f835c18ebd350384e63917 + languageName: node + linkType: hard + "@babel/helper-optimise-call-expression@npm:^7.18.6": version: 7.18.6 resolution: "@babel/helper-optimise-call-expression@npm:7.18.6" @@ -381,6 +471,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-plugin-utils@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/helper-plugin-utils@npm:7.25.9" + checksum: e19ec8acf0b696756e6d84531f532c5fe508dce57aa68c75572a77798bd04587a844a9a6c8ea7d62d673e21fdc174d091c9097fb29aea1c1b49f9c6eaa80f022 + languageName: node + linkType: hard + "@babel/helper-remap-async-to-generator@npm:^7.18.9": version: 7.18.9 resolution: "@babel/helper-remap-async-to-generator@npm:7.18.9" @@ -443,6 +540,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-string-parser@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/helper-string-parser@npm:7.25.9" + checksum: 6435ee0849e101681c1849868278b5aee82686ba2c1e27280e5e8aca6233af6810d39f8e4e693d2f2a44a3728a6ccfd66f72d71826a94105b86b731697cdfa99 + languageName: node + linkType: hard + "@babel/helper-validator-identifier@npm:^7.18.6, @babel/helper-validator-identifier@npm:^7.19.1": version: 7.19.1 resolution: "@babel/helper-validator-identifier@npm:7.19.1" @@ -450,6 +554,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-validator-identifier@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/helper-validator-identifier@npm:7.25.9" + checksum: 5b85918cb1a92a7f3f508ea02699e8d2422fe17ea8e82acd445006c0ef7520fbf48e3dbcdaf7b0a1d571fc3a2715a29719e5226636cb6042e15fe6ed2a590944 + languageName: node + linkType: hard + "@babel/helper-validator-option@npm:^7.18.6": version: 7.21.0 resolution: "@babel/helper-validator-option@npm:7.21.0" @@ -457,6 +568,13 @@ __metadata: languageName: node linkType: hard +"@babel/helper-validator-option@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/helper-validator-option@npm:7.25.9" + checksum: 9491b2755948ebbdd68f87da907283698e663b5af2d2b1b02a2765761974b1120d5d8d49e9175b167f16f72748ffceec8c9cf62acfbee73f4904507b246e2b3d + languageName: node + linkType: hard + "@babel/helper-wrap-function@npm:^7.18.9": version: 7.20.5 resolution: "@babel/helper-wrap-function@npm:7.20.5" @@ -480,6 +598,16 @@ __metadata: languageName: node linkType: hard +"@babel/helpers@npm:^7.26.0": + version: 7.26.0 + resolution: "@babel/helpers@npm:7.26.0" + dependencies: + "@babel/template": ^7.25.9 + "@babel/types": ^7.26.0 + checksum: d77fe8d45033d6007eadfa440355c1355eed57902d5a302f450827ad3d530343430a21210584d32eef2f216ae463d4591184c6fc60cf205bbf3a884561469200 + languageName: node + linkType: hard + "@babel/highlight@npm:^7.18.6": version: 7.18.6 resolution: "@babel/highlight@npm:7.18.6" @@ -500,6 +628,17 @@ __metadata: languageName: node linkType: hard +"@babel/parser@npm:^7.23.9, @babel/parser@npm:^7.25.9, @babel/parser@npm:^7.26.0, @babel/parser@npm:^7.26.2": + version: 7.26.2 + resolution: "@babel/parser@npm:7.26.2" + dependencies: + "@babel/types": ^7.26.0 + bin: + parser: ./bin/babel-parser.js + checksum: c88b5ea0adf357ef909cdc2c31e284a154943edc59f63f6e8a4c20bf773a1b2f3d8c2205e59c09ca7cdad91e7466300114548876529277a80651b6436a48d5d9 + languageName: node + linkType: hard + "@babel/plugin-external-helpers@npm:^7.0.0": version: 7.18.6 resolution: "@babel/plugin-external-helpers@npm:7.18.6" @@ -686,6 +825,17 @@ __metadata: languageName: node linkType: hard +"@babel/plugin-syntax-jsx@npm:^7.7.2": + version: 7.25.9 + resolution: "@babel/plugin-syntax-jsx@npm:7.25.9" + dependencies: + "@babel/helper-plugin-utils": ^7.25.9 + peerDependencies: + "@babel/core": ^7.0.0-0 + checksum: bb609d1ffb50b58f0c1bac8810d0e46a4f6c922aa171c458f3a19d66ee545d36e782d3bffbbc1fed0dc65a558bdce1caf5279316583c0fff5a2c1658982a8563 + languageName: node + linkType: hard + "@babel/plugin-syntax-logical-assignment-operators@npm:^7.8.3": version: 7.10.4 resolution: "@babel/plugin-syntax-logical-assignment-operators@npm:7.10.4" @@ -1205,7 +1355,18 @@ __metadata: languageName: node linkType: hard -"@babel/traverse@npm:^7.0.0, @babel/traverse@npm:^7.20.5, @babel/traverse@npm:^7.20.7, @babel/traverse@npm:^7.21.0, @babel/traverse@npm:^7.21.2, @babel/traverse@npm:^7.4.3, @babel/traverse@npm:^7.7.2": +"@babel/template@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/template@npm:7.25.9" + dependencies: + "@babel/code-frame": ^7.25.9 + "@babel/parser": ^7.25.9 + "@babel/types": ^7.25.9 + checksum: 103641fea19c7f4e82dc913aa6b6ac157112a96d7c724d513288f538b84bae04fb87b1f1e495ac1736367b1bc30e10f058b30208fb25f66038e1f1eb4e426472 + languageName: node + linkType: hard + +"@babel/traverse@npm:^7.0.0, @babel/traverse@npm:^7.20.5, @babel/traverse@npm:^7.20.7, @babel/traverse@npm:^7.21.0, @babel/traverse@npm:^7.21.2, @babel/traverse@npm:^7.4.3": version: 7.21.2 resolution: "@babel/traverse@npm:7.21.2" dependencies: @@ -1223,6 +1384,21 @@ __metadata: languageName: node linkType: hard +"@babel/traverse@npm:^7.25.9": + version: 7.25.9 + resolution: "@babel/traverse@npm:7.25.9" + dependencies: + "@babel/code-frame": ^7.25.9 + "@babel/generator": ^7.25.9 + "@babel/parser": ^7.25.9 + "@babel/template": ^7.25.9 + "@babel/types": ^7.25.9 + debug: ^4.3.1 + globals: ^11.1.0 + checksum: 901d325662ff1dd9bc51de00862e01055fa6bc374f5297d7e3731f2f0e268bbb1d2141f53fa82860aa308ee44afdcf186a948f16c83153927925804b95a9594d + languageName: node + linkType: hard + "@babel/types@npm:^7.0.0, @babel/types@npm:^7.18.6, @babel/types@npm:^7.18.9, @babel/types@npm:^7.20.0, @babel/types@npm:^7.20.2, @babel/types@npm:^7.20.5, @babel/types@npm:^7.20.7, @babel/types@npm:^7.21.0, @babel/types@npm:^7.21.2, @babel/types@npm:^7.3.0, @babel/types@npm:^7.3.3, @babel/types@npm:^7.4.0, @babel/types@npm:^7.8.3": version: 7.21.2 resolution: "@babel/types@npm:7.21.2" @@ -1234,6 +1410,16 @@ __metadata: languageName: node linkType: hard +"@babel/types@npm:^7.25.9, @babel/types@npm:^7.26.0": + version: 7.26.0 + resolution: "@babel/types@npm:7.26.0" + dependencies: + "@babel/helper-string-parser": ^7.25.9 + "@babel/helper-validator-identifier": ^7.25.9 + checksum: a3dd37dabac693018872da96edb8c1843a605c1bfacde6c3f504fba79b972426a6f24df70aa646356c0c1b19bdd2c722c623c684a996c002381071680602280d + languageName: node + linkType: hard + "@bcoe/v8-coverage@npm:^0.2.3": version: 0.2.3 resolution: "@bcoe/v8-coverage@npm:0.2.3" @@ -1606,16 +1792,6 @@ __metadata: languageName: node linkType: hard -"@ikscodes/browser-env@npm:~0.3.1": - version: 0.3.1 - resolution: "@ikscodes/browser-env@npm:0.3.1" - dependencies: - jsdom: ~15.2.1 - lodash: ~4.17.15 - checksum: eb717e4dcbafeb4fef3583a9b378f96c828feb4f62a78322faa28bb319556f714cbf5a84b27af248d141eea74ececa200f814cf8c9ccc3c36fbacd20b92d47ef - languageName: node - linkType: hard - "@isaacs/cliui@npm:^8.0.2": version: 8.0.2 resolution: "@isaacs/cliui@npm:8.0.2" @@ -1653,7 +1829,7 @@ __metadata: languageName: node linkType: hard -"@istanbuljs/schema@npm:^0.1.2": +"@istanbuljs/schema@npm:^0.1.2, @istanbuljs/schema@npm:^0.1.3": version: 0.1.3 resolution: "@istanbuljs/schema@npm:0.1.3" checksum: 5282759d961d61350f33d9118d16bcaed914ebf8061a52f4fa474b2cb08720c9c81d165e13b82f2e5a8a212cc5af482f0c6fc1ac27b9e067e5394c9a6ed186c9 @@ -1671,50 +1847,50 @@ __metadata: languageName: node linkType: hard -"@jest/console@npm:^27.5.1": - version: 27.5.1 - resolution: "@jest/console@npm:27.5.1" +"@jest/console@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/console@npm:29.7.0" dependencies: - "@jest/types": ^27.5.1 + "@jest/types": ^29.6.3 "@types/node": "*" chalk: ^4.0.0 - jest-message-util: ^27.5.1 - jest-util: ^27.5.1 + jest-message-util: ^29.7.0 + jest-util: ^29.7.0 slash: ^3.0.0 - checksum: 7cb20f06a34b09734c0342685ec53aa4c401fe3757c13a9c58fce76b971a322eb884f6de1068ef96f746e5398e067371b89515a07c268d4440a867c87748a706 + checksum: 0e3624e32c5a8e7361e889db70b170876401b7d70f509a2538c31d5cd50deb0c1ae4b92dc63fe18a0902e0a48c590c21d53787a0df41a52b34fa7cab96c384d6 languageName: node linkType: hard -"@jest/core@npm:^27.5.1": - version: 27.5.1 - resolution: "@jest/core@npm:27.5.1" +"@jest/core@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/core@npm:29.7.0" dependencies: - "@jest/console": ^27.5.1 - "@jest/reporters": ^27.5.1 - "@jest/test-result": ^27.5.1 - "@jest/transform": ^27.5.1 - "@jest/types": ^27.5.1 + "@jest/console": ^29.7.0 + "@jest/reporters": ^29.7.0 + "@jest/test-result": ^29.7.0 + "@jest/transform": ^29.7.0 + "@jest/types": ^29.6.3 "@types/node": "*" ansi-escapes: ^4.2.1 chalk: ^4.0.0 - emittery: ^0.8.1 + ci-info: ^3.2.0 exit: ^0.1.2 graceful-fs: ^4.2.9 - jest-changed-files: ^27.5.1 - jest-config: ^27.5.1 - jest-haste-map: ^27.5.1 - jest-message-util: ^27.5.1 - jest-regex-util: ^27.5.1 - jest-resolve: ^27.5.1 - jest-resolve-dependencies: ^27.5.1 - jest-runner: ^27.5.1 - jest-runtime: ^27.5.1 - jest-snapshot: ^27.5.1 - jest-util: ^27.5.1 - jest-validate: ^27.5.1 - jest-watcher: ^27.5.1 + jest-changed-files: ^29.7.0 + jest-config: ^29.7.0 + jest-haste-map: ^29.7.0 + jest-message-util: ^29.7.0 + jest-regex-util: ^29.6.3 + jest-resolve: ^29.7.0 + jest-resolve-dependencies: ^29.7.0 + jest-runner: ^29.7.0 + jest-runtime: ^29.7.0 + jest-snapshot: ^29.7.0 + jest-util: ^29.7.0 + jest-validate: ^29.7.0 + jest-watcher: ^29.7.0 micromatch: ^4.0.4 - rimraf: ^3.0.0 + pretty-format: ^29.7.0 slash: ^3.0.0 strip-ansi: ^6.0.0 peerDependencies: @@ -1722,19 +1898,38 @@ __metadata: peerDependenciesMeta: node-notifier: optional: true - checksum: 904a94ad8f1b43cd6b48de3b0226659bff3696150ff8cf7680fc2faffdc8a115203bb9ab6e817c1f79f9d6a81f67953053cbc64d8a4604f2e0c42a04c28cf126 + checksum: af759c9781cfc914553320446ce4e47775ae42779e73621c438feb1e4231a5d4862f84b1d8565926f2d1aab29b3ec3dcfdc84db28608bdf5f29867124ebcfc0d languageName: node linkType: hard -"@jest/environment@npm:^27.5.1": - version: 27.5.1 - resolution: "@jest/environment@npm:27.5.1" +"@jest/environment@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/environment@npm:29.7.0" dependencies: - "@jest/fake-timers": ^27.5.1 - "@jest/types": ^27.5.1 + "@jest/fake-timers": ^29.7.0 + "@jest/types": ^29.6.3 "@types/node": "*" - jest-mock: ^27.5.1 - checksum: 2a9e18c35a015508dbec5b90b21c150230fa6c1c8cb8fabe029d46ee2ca4c40eb832fb636157da14c66590d0a4c8a2c053226b041f54a44507d6f6a89abefd66 + jest-mock: ^29.7.0 + checksum: 6fb398143b2543d4b9b8d1c6dbce83fa5247f84f550330604be744e24c2bd2178bb893657d62d1b97cf2f24baf85c450223f8237cccb71192c36a38ea2272934 + languageName: node + linkType: hard + +"@jest/expect-utils@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/expect-utils@npm:29.7.0" + dependencies: + jest-get-type: ^29.6.3 + checksum: 75eb177f3d00b6331bcaa057e07c0ccb0733a1d0a1943e1d8db346779039cb7f103789f16e502f888a3096fb58c2300c38d1f3748b36a7fa762eb6f6d1b160ed + languageName: node + linkType: hard + +"@jest/expect@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/expect@npm:29.7.0" + dependencies: + expect: ^29.7.0 + jest-snapshot: ^29.7.0 + checksum: a01cb85fd9401bab3370618f4b9013b90c93536562222d920e702a0b575d239d74cecfe98010aaec7ad464f67cf534a353d92d181646a4b792acaa7e912ae55e languageName: node linkType: hard @@ -1749,66 +1944,66 @@ __metadata: languageName: node linkType: hard -"@jest/fake-timers@npm:^27.5.1": - version: 27.5.1 - resolution: "@jest/fake-timers@npm:27.5.1" +"@jest/fake-timers@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/fake-timers@npm:29.7.0" dependencies: - "@jest/types": ^27.5.1 - "@sinonjs/fake-timers": ^8.0.1 + "@jest/types": ^29.6.3 + "@sinonjs/fake-timers": ^10.0.2 "@types/node": "*" - jest-message-util: ^27.5.1 - jest-mock: ^27.5.1 - jest-util: ^27.5.1 - checksum: 02a0561ed2f4586093facd4ae500b74694f187ac24d4a00e949a39a1c5325bca8932b4fcb0388a2c5ed0656506fc1cf51fd3e32cdd48cea7497ad9c6e028aba8 + jest-message-util: ^29.7.0 + jest-mock: ^29.7.0 + jest-util: ^29.7.0 + checksum: caf2bbd11f71c9241b458d1b5a66cbe95debc5a15d96442444b5d5c7ba774f523c76627c6931cca5e10e76f0d08761f6f1f01a608898f4751a0eee54fc3d8d00 languageName: node linkType: hard -"@jest/globals@npm:^27.5.1": - version: 27.5.1 - resolution: "@jest/globals@npm:27.5.1" +"@jest/globals@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/globals@npm:29.7.0" dependencies: - "@jest/environment": ^27.5.1 - "@jest/types": ^27.5.1 - expect: ^27.5.1 - checksum: 087f97047e9dcf555f76fe2ce54aee681e005eaa837a0c0c2d251df6b6412c892c9df54cb871b180342114389a5ff895a4e52e6e6d3d0015bf83c02a54f64c3c + "@jest/environment": ^29.7.0 + "@jest/expect": ^29.7.0 + "@jest/types": ^29.6.3 + jest-mock: ^29.7.0 + checksum: 97dbb9459135693ad3a422e65ca1c250f03d82b2a77f6207e7fa0edd2c9d2015fbe4346f3dc9ebff1678b9d8da74754d4d440b7837497f8927059c0642a22123 languageName: node linkType: hard -"@jest/reporters@npm:^27.5.1": - version: 27.5.1 - resolution: "@jest/reporters@npm:27.5.1" +"@jest/reporters@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/reporters@npm:29.7.0" dependencies: "@bcoe/v8-coverage": ^0.2.3 - "@jest/console": ^27.5.1 - "@jest/test-result": ^27.5.1 - "@jest/transform": ^27.5.1 - "@jest/types": ^27.5.1 + "@jest/console": ^29.7.0 + "@jest/test-result": ^29.7.0 + "@jest/transform": ^29.7.0 + "@jest/types": ^29.6.3 + "@jridgewell/trace-mapping": ^0.3.18 "@types/node": "*" chalk: ^4.0.0 collect-v8-coverage: ^1.0.0 exit: ^0.1.2 - glob: ^7.1.2 + glob: ^7.1.3 graceful-fs: ^4.2.9 istanbul-lib-coverage: ^3.0.0 - istanbul-lib-instrument: ^5.1.0 + istanbul-lib-instrument: ^6.0.0 istanbul-lib-report: ^3.0.0 istanbul-lib-source-maps: ^4.0.0 istanbul-reports: ^3.1.3 - jest-haste-map: ^27.5.1 - jest-resolve: ^27.5.1 - jest-util: ^27.5.1 - jest-worker: ^27.5.1 + jest-message-util: ^29.7.0 + jest-util: ^29.7.0 + jest-worker: ^29.7.0 slash: ^3.0.0 - source-map: ^0.6.0 string-length: ^4.0.1 - terminal-link: ^2.0.0 - v8-to-istanbul: ^8.1.0 + strip-ansi: ^6.0.0 + v8-to-istanbul: ^9.0.1 peerDependencies: node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 peerDependenciesMeta: node-notifier: optional: true - checksum: faba5eafb86e62b62e152cafc8812d56308f9d1e8b77f3a7dcae4a8803a20a60a0909cc43ed73363ef649bf558e4fb181c7a336d144c89f7998279d1882bb69e + checksum: 7eadabd62cc344f629024b8a268ecc8367dba756152b761bdcb7b7e570a3864fc51b2a9810cd310d85e0a0173ef002ba4528d5ea0329fbf66ee2a3ada9c40455 languageName: node linkType: hard @@ -1832,14 +2027,14 @@ __metadata: languageName: node linkType: hard -"@jest/source-map@npm:^27.5.1": - version: 27.5.1 - resolution: "@jest/source-map@npm:27.5.1" +"@jest/source-map@npm:^29.6.3": + version: 29.6.3 + resolution: "@jest/source-map@npm:29.6.3" dependencies: + "@jridgewell/trace-mapping": ^0.3.18 callsites: ^3.0.0 graceful-fs: ^4.2.9 - source-map: ^0.6.0 - checksum: 4fb1e743b602841babf7e22bd84eca34676cb05d4eb3b604cae57fc59e406099f5ac759ac1a0d04d901237d143f0f4f234417306e823bde732a1d19982230862 + checksum: bcc5a8697d471396c0003b0bfa09722c3cd879ad697eb9c431e6164e2ea7008238a01a07193dfe3cbb48b1d258eb7251f6efcea36f64e1ebc464ea3c03ae2deb languageName: node linkType: hard @@ -1854,27 +2049,27 @@ __metadata: languageName: node linkType: hard -"@jest/test-result@npm:^27.5.1": - version: 27.5.1 - resolution: "@jest/test-result@npm:27.5.1" +"@jest/test-result@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/test-result@npm:29.7.0" dependencies: - "@jest/console": ^27.5.1 - "@jest/types": ^27.5.1 + "@jest/console": ^29.7.0 + "@jest/types": ^29.6.3 "@types/istanbul-lib-coverage": ^2.0.0 collect-v8-coverage: ^1.0.0 - checksum: 338f7c509d6a3bc6d7dd7388c8f6f548b87638e171dc1fddfedcacb4e8950583288832223ba688058cbcf874b937d22bdc0fa88f79f5fc666f77957e465c06a5 + checksum: 67b6317d526e335212e5da0e768e3b8ab8a53df110361b80761353ad23b6aea4432b7c5665bdeb87658ea373b90fb1afe02ed3611ef6c858c7fba377505057fa languageName: node linkType: hard -"@jest/test-sequencer@npm:^27.5.1": - version: 27.5.1 - resolution: "@jest/test-sequencer@npm:27.5.1" +"@jest/test-sequencer@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/test-sequencer@npm:29.7.0" dependencies: - "@jest/test-result": ^27.5.1 + "@jest/test-result": ^29.7.0 graceful-fs: ^4.2.9 - jest-haste-map: ^27.5.1 - jest-runtime: ^27.5.1 - checksum: f21f9c8bb746847f7f89accfd29d6046eec1446f0b54e4694444feaa4df379791f76ef0f5a4360aafcbc73b50bc979f68b8a7620de404019d3de166be6720cb0 + jest-haste-map: ^29.7.0 + slash: ^3.0.0 + checksum: 73f43599017946be85c0b6357993b038f875b796e2f0950487a82f4ebcb115fa12131932dd9904026b4ad8be131fe6e28bd8d0aa93b1563705185f9804bff8bd languageName: node linkType: hard @@ -1901,6 +2096,29 @@ __metadata: languageName: node linkType: hard +"@jest/transform@npm:^29.7.0": + version: 29.7.0 + resolution: "@jest/transform@npm:29.7.0" + dependencies: + "@babel/core": ^7.11.6 + "@jest/types": ^29.6.3 + "@jridgewell/trace-mapping": ^0.3.18 + babel-plugin-istanbul: ^6.1.1 + chalk: ^4.0.0 + convert-source-map: ^2.0.0 + fast-json-stable-stringify: ^2.1.0 + graceful-fs: ^4.2.9 + jest-haste-map: ^29.7.0 + jest-regex-util: ^29.6.3 + jest-util: ^29.7.0 + micromatch: ^4.0.4 + pirates: ^4.0.4 + slash: ^3.0.0 + write-file-atomic: ^4.0.2 + checksum: 0f8ac9f413903b3cb6d240102db848f2a354f63971ab885833799a9964999dd51c388162106a807f810071f864302cdd8e3f0c241c29ce02d85a36f18f3f40ab + languageName: node + linkType: hard + "@jest/types@npm:^24.9.0": version: 24.9.0 resolution: "@jest/types@npm:24.9.0" @@ -1937,6 +2155,20 @@ __metadata: languageName: node linkType: hard +"@jest/types@npm:^29.6.3": + version: 29.6.3 + resolution: "@jest/types@npm:29.6.3" + dependencies: + "@jest/schemas": ^29.6.3 + "@types/istanbul-lib-coverage": ^2.0.0 + "@types/istanbul-reports": ^3.0.0 + "@types/node": "*" + "@types/yargs": ^17.0.8 + chalk: ^4.0.0 + checksum: a0bcf15dbb0eca6bdd8ce61a3fb055349d40268622a7670a3b2eb3c3dbafe9eb26af59938366d520b86907b9505b0f9b29b85cec11579a9e580694b87cd90fcc + languageName: node + linkType: hard + "@jridgewell/gen-mapping@npm:^0.1.0": version: 0.1.1 resolution: "@jridgewell/gen-mapping@npm:0.1.1" @@ -1958,6 +2190,17 @@ __metadata: languageName: node linkType: hard +"@jridgewell/gen-mapping@npm:^0.3.5": + version: 0.3.5 + resolution: "@jridgewell/gen-mapping@npm:0.3.5" + dependencies: + "@jridgewell/set-array": ^1.2.1 + "@jridgewell/sourcemap-codec": ^1.4.10 + "@jridgewell/trace-mapping": ^0.3.24 + checksum: ff7a1764ebd76a5e129c8890aa3e2f46045109dabde62b0b6c6a250152227647178ff2069ea234753a690d8f3c4ac8b5e7b267bbee272bffb7f3b0a370ab6e52 + languageName: node + linkType: hard + "@jridgewell/resolve-uri@npm:3.1.0, @jridgewell/resolve-uri@npm:^3.0.3": version: 3.1.0 resolution: "@jridgewell/resolve-uri@npm:3.1.0" @@ -1965,6 +2208,13 @@ __metadata: languageName: node linkType: hard +"@jridgewell/resolve-uri@npm:^3.1.0": + version: 3.1.2 + resolution: "@jridgewell/resolve-uri@npm:3.1.2" + checksum: 83b85f72c59d1c080b4cbec0fef84528963a1b5db34e4370fa4bd1e3ff64a0d80e0cee7369d11d73c704e0286fb2865b530acac7a871088fbe92b5edf1000870 + languageName: node + linkType: hard + "@jridgewell/set-array@npm:^1.0.0, @jridgewell/set-array@npm:^1.0.1": version: 1.1.2 resolution: "@jridgewell/set-array@npm:1.1.2" @@ -1972,6 +2222,13 @@ __metadata: languageName: node linkType: hard +"@jridgewell/set-array@npm:^1.2.1": + version: 1.2.1 + resolution: "@jridgewell/set-array@npm:1.2.1" + checksum: 832e513a85a588f8ed4f27d1279420d8547743cc37fcad5a5a76fc74bb895b013dfe614d0eed9cb860048e6546b798f8f2652020b4b2ba0561b05caa8c654b10 + languageName: node + linkType: hard + "@jridgewell/sourcemap-codec@npm:1.4.14, @jridgewell/sourcemap-codec@npm:^1.4.10": version: 1.4.14 resolution: "@jridgewell/sourcemap-codec@npm:1.4.14" @@ -1979,6 +2236,13 @@ __metadata: languageName: node linkType: hard +"@jridgewell/sourcemap-codec@npm:^1.4.14": + version: 1.5.0 + resolution: "@jridgewell/sourcemap-codec@npm:1.5.0" + checksum: 05df4f2538b3b0f998ea4c1cd34574d0feba216fa5d4ccaef0187d12abf82eafe6021cec8b49f9bb4d90f2ba4582ccc581e72986a5fcf4176ae0cfeb04cf52ec + languageName: node + linkType: hard + "@jridgewell/trace-mapping@npm:0.3.9": version: 0.3.9 resolution: "@jridgewell/trace-mapping@npm:0.3.9" @@ -1989,6 +2253,16 @@ __metadata: languageName: node linkType: hard +"@jridgewell/trace-mapping@npm:^0.3.12, @jridgewell/trace-mapping@npm:^0.3.18, @jridgewell/trace-mapping@npm:^0.3.24, @jridgewell/trace-mapping@npm:^0.3.25": + version: 0.3.25 + resolution: "@jridgewell/trace-mapping@npm:0.3.25" + dependencies: + "@jridgewell/resolve-uri": ^3.1.0 + "@jridgewell/sourcemap-codec": ^1.4.14 + checksum: 9d3c40d225e139987b50c48988f8717a54a8c994d8a948ee42e1412e08988761d0754d7d10b803061cc3aebf35f92a5dbbab493bd0e1a9ef9e89a2130e83ba34 + languageName: node + linkType: hard + "@jridgewell/trace-mapping@npm:^0.3.17, @jridgewell/trace-mapping@npm:^0.3.9": version: 0.3.17 resolution: "@jridgewell/trace-mapping@npm:0.3.17" @@ -3581,21 +3855,21 @@ __metadata: languageName: node linkType: hard -"@sinonjs/commons@npm:^1.7.0": - version: 1.8.6 - resolution: "@sinonjs/commons@npm:1.8.6" +"@sinonjs/commons@npm:^3.0.0": + version: 3.0.1 + resolution: "@sinonjs/commons@npm:3.0.1" dependencies: type-detect: 4.0.8 - checksum: 7d3f8c1e85f30cd4e83594fc19b7a657f14d49eb8d95a30095631ce15e906c869e0eff96c5b93dffea7490c00418b07f54582ba49c6560feb2a8c34c0b16832d + checksum: a7c3e7cc612352f4004873747d9d8b2d4d90b13a6d483f685598c945a70e734e255f1ca5dc49702515533c403b32725defff148177453b3f3915bcb60e9d4601 languageName: node linkType: hard -"@sinonjs/fake-timers@npm:^8.0.1": - version: 8.1.0 - resolution: "@sinonjs/fake-timers@npm:8.1.0" +"@sinonjs/fake-timers@npm:^10.0.2": + version: 10.3.0 + resolution: "@sinonjs/fake-timers@npm:10.3.0" dependencies: - "@sinonjs/commons": ^1.7.0 - checksum: 09b5a158ce013a6c37613258bad79ca4efeb99b1f59c41c73cca36cac00b258aefcf46eeea970fccf06b989414d86fe9f54c1102272c0c3bdd51a313cea80949 + "@sinonjs/commons": ^3.0.0 + checksum: 614d30cb4d5201550c940945d44c9e0b6d64a888ff2cd5b357f95ad6721070d6b8839cd10e15b76bf5e14af0bcc1d8f9ec00d49a46318f1f669a4bec1d7f3148 languageName: node linkType: hard @@ -3650,13 +3924,6 @@ __metadata: languageName: node linkType: hard -"@tootallnate/once@npm:1": - version: 1.1.2 - resolution: "@tootallnate/once@npm:1.1.2" - checksum: e1fb1bbbc12089a0cb9433dc290f97bddd062deadb6178ce9bcb93bb7c1aecde5e60184bc7065aec42fe1663622a213493c48bbd4972d931aae48315f18e1be9 - languageName: node - linkType: hard - "@tootallnate/once@npm:2": version: 2.0.0 resolution: "@tootallnate/once@npm:2.0.0" @@ -3758,7 +4025,7 @@ __metadata: languageName: node linkType: hard -"@types/babel__traverse@npm:*, @types/babel__traverse@npm:^7.0.4, @types/babel__traverse@npm:^7.0.6": +"@types/babel__traverse@npm:*, @types/babel__traverse@npm:^7.0.6": version: 7.18.3 resolution: "@types/babel__traverse@npm:7.18.3" dependencies: @@ -3850,6 +4117,15 @@ __metadata: languageName: node linkType: hard +"@types/graceful-fs@npm:^4.1.3": + version: 4.1.9 + resolution: "@types/graceful-fs@npm:4.1.9" + dependencies: + "@types/node": "*" + checksum: 79d746a8f053954bba36bd3d94a90c78de995d126289d656fb3271dd9f1229d33f678da04d10bce6be440494a5a73438e2e363e92802d16b8315b051036c5256 + languageName: node + linkType: hard + "@types/inquirer@npm:^8.1.1": version: 8.2.6 resolution: "@types/inquirer@npm:8.2.6" @@ -3904,13 +4180,24 @@ __metadata: languageName: node linkType: hard -"@types/jest@npm:^27.0.0": - version: 27.5.2 - resolution: "@types/jest@npm:27.5.2" +"@types/jest@npm:^29.5.11": + version: 29.5.14 + resolution: "@types/jest@npm:29.5.14" + dependencies: + expect: ^29.0.0 + pretty-format: ^29.0.0 + checksum: 18dba4623f26661641d757c63da2db45e9524c9be96a29ef713c703a9a53792df9ecee9f7365a0858ddbd6440d98fe6b65ca67895ca5884b73cbc7ffc11f3838 + languageName: node + linkType: hard + +"@types/jsdom@npm:^20.0.0": + version: 20.0.1 + resolution: "@types/jsdom@npm:20.0.1" dependencies: - jest-matcher-utils: ^27.0.0 - pretty-format: ^27.0.0 - checksum: 7e11c6826aa429ad990dc262e4e4b54aa36573287fddf15773e4137f07d11d3105f0dd9f1baff73252160a057df23f5529bb83b1bf83cd3f45f9460a5ca5c22e + "@types/node": "*" + "@types/tough-cookie": "*" + parse5: ^7.0.0 + checksum: d55402c5256ef451f93a6e3d3881f98339fe73a5ac2030588df056d6835df8367b5a857b48d27528289057e26dcdd3f502edc00cb877c79174cb3a4c7f2198c1 languageName: node linkType: hard @@ -4011,13 +4298,6 @@ __metadata: languageName: node linkType: hard -"@types/prettier@npm:^2.1.5": - version: 2.7.2 - resolution: "@types/prettier@npm:2.7.2" - checksum: b47d76a5252265f8d25dd2fe2a5a61dc43ba0e6a96ffdd00c594cb4fd74c1982c2e346497e3472805d97915407a09423804cc2110a0b8e1b22cffcab246479b7 - languageName: node - linkType: hard - "@types/prop-types@npm:*": version: 15.7.5 resolution: "@types/prop-types@npm:15.7.5" @@ -4162,6 +4442,15 @@ __metadata: languageName: node linkType: hard +"@types/yargs@npm:^17.0.8": + version: 17.0.33 + resolution: "@types/yargs@npm:17.0.33" + dependencies: + "@types/yargs-parser": "*" + checksum: ee013f257472ab643cb0584cf3e1ff9b0c44bca1c9ba662395300a7f1a6c55fa9d41bd40ddff42d99f5d95febb3907c9ff600fbcb92dadbec22c6a76de7e1236 + languageName: node + linkType: hard + "@typescript-eslint/eslint-plugin@npm:^7.18.0": version: 7.18.0 resolution: "@typescript-eslint/eslint-plugin@npm:7.18.0" @@ -4366,7 +4655,7 @@ __metadata: languageName: node linkType: hard -"abab@npm:^2.0.0, abab@npm:^2.0.3, abab@npm:^2.0.5": +"abab@npm:^2.0.6": version: 2.0.6 resolution: "abab@npm:2.0.6" checksum: 6ffc1af4ff315066c62600123990d87551ceb0aafa01e6539da77b0f5987ac7019466780bf480f1787576d4385e3690c81ccc37cfda12819bf510b8ab47e5a3e @@ -4413,23 +4702,13 @@ __metadata: languageName: node linkType: hard -"acorn-globals@npm:^4.3.2": - version: 4.3.4 - resolution: "acorn-globals@npm:4.3.4" - dependencies: - acorn: ^6.0.1 - acorn-walk: ^6.0.1 - checksum: c31bfde102d8a104835e9591c31dd037ec771449f9c86a6b1d2ac3c7c336694f828cfabba7687525b094f896a854affbf1afe6e1b12c0d998be6bab5d49c9663 - languageName: node - linkType: hard - -"acorn-globals@npm:^6.0.0": - version: 6.0.0 - resolution: "acorn-globals@npm:6.0.0" +"acorn-globals@npm:^7.0.0": + version: 7.0.1 + resolution: "acorn-globals@npm:7.0.1" dependencies: - acorn: ^7.1.1 - acorn-walk: ^7.1.1 - checksum: 72d95e5b5e585f9acd019b993ab8bbba68bb3cbc9d9b5c1ebb3c2f1fe5981f11deababfb4949f48e6262f9c57878837f5958c0cca396f81023814680ca878042 + acorn: ^8.1.0 + acorn-walk: ^8.0.2 + checksum: 2a2998a547af6d0db5f0cdb90acaa7c3cbca6709010e02121fb8b8617c0fbd8bab0b869579903fde358ac78454356a14fadcc1a672ecb97b04b1c2ccba955ce8 languageName: node linkType: hard @@ -4442,17 +4721,12 @@ __metadata: languageName: node linkType: hard -"acorn-walk@npm:^6.0.1": - version: 6.2.0 - resolution: "acorn-walk@npm:6.2.0" - checksum: ea241a5d96338f1e8030aafae72a91ff0ec4360e2775e44a2fdb2eb618b07fc309e000a5126056631ac7f00fe8bd9bbd23fcb6d018eee4ba11086eb36c1b2e61 - languageName: node - linkType: hard - -"acorn-walk@npm:^7.1.1": - version: 7.2.0 - resolution: "acorn-walk@npm:7.2.0" - checksum: 9252158a79b9d92f1bc0dd6acc0fcfb87a67339e84bcc301bb33d6078936d27e35d606b4d35626d2962cd43c256d6f27717e70cbe15c04fff999ab0b2260b21f +"acorn-walk@npm:^8.0.2": + version: 8.3.4 + resolution: "acorn-walk@npm:8.3.4" + dependencies: + acorn: ^8.11.0 + checksum: 4ff03f42323e7cf90f1683e08606b0f460e1e6ac263d2730e3df91c7665b6f64e696db6ea27ee4bed18c2599569be61f28a8399fa170c611161a348c402ca19c languageName: node linkType: hard @@ -4463,25 +4737,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^6.0.1": - version: 6.4.2 - resolution: "acorn@npm:6.4.2" - bin: - acorn: bin/acorn - checksum: 44b07053729db7f44d28343eed32247ed56dc4a6ec6dff2b743141ecd6b861406bbc1c20bf9d4f143ea7dd08add5dc8c290582756539bc03a8db605050ce2fb4 - languageName: node - linkType: hard - -"acorn@npm:^7.1.0, acorn@npm:^7.1.1": - version: 7.4.1 - resolution: "acorn@npm:7.4.1" - bin: - acorn: bin/acorn - checksum: 1860f23c2107c910c6177b7b7be71be350db9e1080d814493fae143ae37605189504152d1ba8743ba3178d0b37269ce1ffc42b101547fdc1827078f82671e407 - languageName: node - linkType: hard - -"acorn@npm:^8.14.0": +"acorn@npm:^8.1.0, acorn@npm:^8.11.0, acorn@npm:^8.14.0, acorn@npm:^8.8.1": version: 8.14.0 resolution: "acorn@npm:8.14.0" bin: @@ -4490,7 +4746,7 @@ __metadata: languageName: node linkType: hard -"acorn@npm:^8.2.4, acorn@npm:^8.4.1": +"acorn@npm:^8.4.1": version: 8.8.2 resolution: "acorn@npm:8.8.2" bin: @@ -4554,7 +4810,7 @@ __metadata: languageName: node linkType: hard -"ajv@npm:^6.12.3, ajv@npm:^6.12.4": +"ajv@npm:^6.12.4": version: 6.12.6 resolution: "ajv@npm:6.12.6" dependencies: @@ -4895,13 +5151,6 @@ __metadata: languageName: node linkType: hard -"array-equal@npm:^1.0.0": - version: 1.0.0 - resolution: "array-equal@npm:1.0.0" - checksum: 3f68045806357db9b2fa1ad583e42a659de030633118a0cd35ee4975cb20db3b9a3d36bbec9b5afe70011cf989eefd215c12fe0ce08c498f770859ca6e70688a - languageName: node - linkType: hard - "array-filter@npm:~0.0.0": version: 0.0.1 resolution: "array-filter@npm:0.0.1" @@ -5108,15 +5357,6 @@ __metadata: languageName: node linkType: hard -"asn1@npm:~0.2.3": - version: 0.2.6 - resolution: "asn1@npm:0.2.6" - dependencies: - safer-buffer: ~2.1.0 - checksum: 39f2ae343b03c15ad4f238ba561e626602a3de8d94ae536c46a4a93e69578826305366dc09fbb9b56aec39b4982a463682f259c38e59f6fa380cd72cd61e493d - languageName: node - linkType: hard - "asn1js@npm:^3.0.1, asn1js@npm:^3.0.5": version: 3.0.5 resolution: "asn1js@npm:3.0.5" @@ -5128,13 +5368,6 @@ __metadata: languageName: node linkType: hard -"assert-plus@npm:1.0.0, assert-plus@npm:^1.0.0": - version: 1.0.0 - resolution: "assert-plus@npm:1.0.0" - checksum: 19b4340cb8f0e6a981c07225eacac0e9d52c2644c080198765d63398f0075f83bbc0c8e95474d54224e297555ad0d631c1dcd058adb1ddc2437b41a6b424ac64 - languageName: node - linkType: hard - "assign-symbols@npm:^1.0.0": version: 1.0.0 resolution: "assign-symbols@npm:1.0.0" @@ -5247,20 +5480,6 @@ __metadata: languageName: node linkType: hard -"aws-sign2@npm:~0.7.0": - version: 0.7.0 - resolution: "aws-sign2@npm:0.7.0" - checksum: b148b0bb0778098ad8cf7e5fc619768bcb51236707ca1d3e5b49e41b171166d8be9fdc2ea2ae43d7decf02989d0aaa3a9c4caa6f320af95d684de9b548a71525 - languageName: node - linkType: hard - -"aws4@npm:^1.8.0": - version: 1.12.0 - resolution: "aws4@npm:1.12.0" - checksum: 68f79708ac7c335992730bf638286a3ee0a645cf12575d557860100767c500c08b30e24726b9f03265d74116417f628af78509e1333575e9f8d52a80edfe8cbc - languageName: node - linkType: hard - "axe-core@npm:^4.10.0": version: 4.10.2 resolution: "axe-core@npm:4.10.2" @@ -5296,7 +5515,7 @@ __metadata: languageName: node linkType: hard -"babel-jest@npm:^27.0.6, babel-jest@npm:^27.5.1": +"babel-jest@npm:^27.0.6": version: 27.5.1 resolution: "babel-jest@npm:27.5.1" dependencies: @@ -5314,9 +5533,26 @@ __metadata: languageName: node linkType: hard -"babel-plugin-istanbul@npm:^6.1.1": - version: 6.1.1 - resolution: "babel-plugin-istanbul@npm:6.1.1" +"babel-jest@npm:^29.7.0": + version: 29.7.0 + resolution: "babel-jest@npm:29.7.0" + dependencies: + "@jest/transform": ^29.7.0 + "@types/babel__core": ^7.1.14 + babel-plugin-istanbul: ^6.1.1 + babel-preset-jest: ^29.6.3 + chalk: ^4.0.0 + graceful-fs: ^4.2.9 + slash: ^3.0.0 + peerDependencies: + "@babel/core": ^7.8.0 + checksum: ee6f8e0495afee07cac5e4ee167be705c711a8cc8a737e05a587a131fdae2b3c8f9aa55dfd4d9c03009ac2d27f2de63d8ba96d3e8460da4d00e8af19ef9a83f7 + languageName: node + linkType: hard + +"babel-plugin-istanbul@npm:^6.1.1": + version: 6.1.1 + resolution: "babel-plugin-istanbul@npm:6.1.1" dependencies: "@babel/helper-plugin-utils": ^7.0.0 "@istanbuljs/load-nyc-config": ^1.0.0 @@ -5339,6 +5575,18 @@ __metadata: languageName: node linkType: hard +"babel-plugin-jest-hoist@npm:^29.6.3": + version: 29.6.3 + resolution: "babel-plugin-jest-hoist@npm:29.6.3" + dependencies: + "@babel/template": ^7.3.3 + "@babel/types": ^7.3.3 + "@types/babel__core": ^7.1.14 + "@types/babel__traverse": ^7.0.6 + checksum: 51250f22815a7318f17214a9d44650ba89551e6d4f47a2dc259128428324b52f5a73979d010cefd921fd5a720d8c1d55ad74ff601cd94c7bd44d5f6292fde2d1 + languageName: node + linkType: hard + "babel-plugin-polyfill-corejs2@npm:^0.3.3": version: 0.3.3 resolution: "babel-plugin-polyfill-corejs2@npm:0.3.3" @@ -5453,6 +5701,18 @@ __metadata: languageName: node linkType: hard +"babel-preset-jest@npm:^29.6.3": + version: 29.6.3 + resolution: "babel-preset-jest@npm:29.6.3" + dependencies: + babel-plugin-jest-hoist: ^29.6.3 + babel-preset-current-node-syntax: ^1.0.0 + peerDependencies: + "@babel/core": ^7.0.0 + checksum: aa4ff2a8a728d9d698ed521e3461a109a1e66202b13d3494e41eea30729a5e7cc03b3a2d56c594423a135429c37bf63a9fa8b0b9ce275298be3095a88c69f6fb + languageName: node + linkType: hard + "balanced-match@npm:^1.0.0": version: 1.0.2 resolution: "balanced-match@npm:1.0.2" @@ -5491,15 +5751,6 @@ __metadata: languageName: node linkType: hard -"bcrypt-pbkdf@npm:^1.0.0": - version: 1.0.2 - resolution: "bcrypt-pbkdf@npm:1.0.2" - dependencies: - tweetnacl: ^0.14.3 - checksum: 4edfc9fe7d07019609ccf797a2af28351736e9d012c8402a07120c4453a3b789a15f2ee1530dc49eee8f7eb9379331a8dd4b3766042b9e502f74a68e7f662291 - languageName: node - linkType: hard - "before-after-hook@npm:^2.2.0": version: 2.2.3 resolution: "before-after-hook@npm:2.2.3" @@ -5691,13 +5942,6 @@ __metadata: languageName: node linkType: hard -"browser-process-hrtime@npm:^1.0.0": - version: 1.0.0 - resolution: "browser-process-hrtime@npm:1.0.0" - checksum: e30f868cdb770b1201afb714ad1575dd86366b6e861900884665fb627109b3cc757c40067d3bfee1ff2a29c835257ea30725a8018a9afd02ac1c24b408b1e45f - languageName: node - linkType: hard - "browserify-aes@npm:^1.2.0": version: 1.2.0 resolution: "browserify-aes@npm:1.2.0" @@ -5726,7 +5970,21 @@ __metadata: languageName: node linkType: hard -"bs-logger@npm:0.x": +"browserslist@npm:^4.24.0": + version: 4.24.2 + resolution: "browserslist@npm:4.24.2" + dependencies: + caniuse-lite: ^1.0.30001669 + electron-to-chromium: ^1.5.41 + node-releases: ^2.0.18 + update-browserslist-db: ^1.1.1 + bin: + browserslist: cli.js + checksum: cf64085f12132d38638f38937a255edb82c7551b164a98577b055dd79719187a816112f7b97b9739e400c4954cd66479c0d7a843cb816e346f4795dc24fd5d97 + languageName: node + linkType: hard + +"bs-logger@npm:^0.2.6": version: 0.2.6 resolution: "bs-logger@npm:0.2.6" dependencies: @@ -6051,6 +6309,13 @@ __metadata: languageName: node linkType: hard +"caniuse-lite@npm:^1.0.30001669": + version: 1.0.30001684 + resolution: "caniuse-lite@npm:1.0.30001684" + checksum: 5ee7aca9c29067d2e4c88cd05cbc062599d86389cd99e26e4d4bf84de8fad3f9ed2be9d3d909dfb65f50e77a17192175cb132eca7f0988ab0f3e8c4aa0dccd38 + languageName: node + linkType: hard + "capture-exit@npm:^2.0.0": version: 2.0.0 resolution: "capture-exit@npm:2.0.0" @@ -6060,13 +6325,6 @@ __metadata: languageName: node linkType: hard -"caseless@npm:~0.12.0": - version: 0.12.0 - resolution: "caseless@npm:0.12.0" - checksum: b43bd4c440aa1e8ee6baefee8063b4850fd0d7b378f6aabc796c9ec8cb26d27fb30b46885350777d9bd079c5256c0e1329ad0dc7c2817e0bb466810ebb353751 - languageName: node - linkType: hard - "chalk@npm:4.1.0": version: 4.1.0 resolution: "chalk@npm:4.1.0" @@ -6425,7 +6683,7 @@ __metadata: languageName: node linkType: hard -"combined-stream@npm:^1.0.6, combined-stream@npm:^1.0.8, combined-stream@npm:~1.0.6": +"combined-stream@npm:^1.0.8": version: 1.0.8 resolution: "combined-stream@npm:1.0.8" dependencies: @@ -6723,6 +6981,13 @@ __metadata: languageName: node linkType: hard +"convert-source-map@npm:^2.0.0": + version: 2.0.0 + resolution: "convert-source-map@npm:2.0.0" + checksum: 63ae9933be5a2b8d4509daca5124e20c14d023c820258e484e32dc324d34c2754e71297c94a05784064ad27615037ef677e3f0c00469fb55f409d2bb21261035 + languageName: node + linkType: hard + "cookiejar@npm:^2.1.1": version: 2.1.4 resolution: "cookiejar@npm:2.1.4" @@ -6753,13 +7018,6 @@ __metadata: languageName: node linkType: hard -"core-util-is@npm:1.0.2": - version: 1.0.2 - resolution: "core-util-is@npm:1.0.2" - checksum: 7a4c925b497a2c91421e25bf76d6d8190f0b2359a9200dbeed136e63b2931d6294d3b1893eda378883ed363cd950f44a12a401384c609839ea616befb7927dab - languageName: node - linkType: hard - "core-util-is@npm:~1.0.0": version: 1.0.3 resolution: "core-util-is@npm:1.0.3" @@ -6858,6 +7116,23 @@ __metadata: languageName: node linkType: hard +"create-jest@npm:^29.7.0": + version: 29.7.0 + resolution: "create-jest@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + chalk: ^4.0.0 + exit: ^0.1.2 + graceful-fs: ^4.2.9 + jest-config: ^29.7.0 + jest-util: ^29.7.0 + prompts: ^2.0.1 + bin: + create-jest: bin/create-jest.js + checksum: 1427d49458adcd88547ef6fa39041e1fe9033a661293aa8d2c3aa1b4967cb5bf4f0c00436c7a61816558f28ba2ba81a94d5c962e8022ea9a883978fc8e1f2945 + languageName: node + linkType: hard + "create-react-class@npm:^15.6.3": version: 15.7.0 resolution: "create-react-class@npm:15.7.0" @@ -6936,10 +7211,10 @@ __metadata: languageName: node linkType: hard -"cssom@npm:^0.4.1, cssom@npm:^0.4.4": - version: 0.4.4 - resolution: "cssom@npm:0.4.4" - checksum: e3bc1076e7ee4213d4fef05e7ae03bfa83dc05f32611d8edc341f4ecc3d9647b89c8245474c7dd2cdcdb797a27c462e99da7ad00a34399694559f763478ff53f +"cssom@npm:^0.5.0": + version: 0.5.0 + resolution: "cssom@npm:0.5.0" + checksum: 823471aa30091c59e0a305927c30e7768939b6af70405808f8d2ce1ca778cddcb24722717392438329d1691f9a87cb0183b64b8d779b56a961546d54854fde01 languageName: node linkType: hard @@ -6950,7 +7225,7 @@ __metadata: languageName: node linkType: hard -"cssstyle@npm:^2.0.0, cssstyle@npm:^2.3.0": +"cssstyle@npm:^2.3.0": version: 2.3.0 resolution: "cssstyle@npm:2.3.0" dependencies: @@ -6990,34 +7265,14 @@ __metadata: languageName: node linkType: hard -"dashdash@npm:^1.12.0": - version: 1.14.1 - resolution: "dashdash@npm:1.14.1" - dependencies: - assert-plus: ^1.0.0 - checksum: 3634c249570f7f34e3d34f866c93f866c5b417f0dd616275decae08147dcdf8fccfaa5947380ccfb0473998ea3a8057c0b4cd90c875740ee685d0624b2983598 - languageName: node - linkType: hard - -"data-urls@npm:^1.1.0": - version: 1.1.0 - resolution: "data-urls@npm:1.1.0" - dependencies: - abab: ^2.0.0 - whatwg-mimetype: ^2.2.0 - whatwg-url: ^7.0.0 - checksum: dc4bd9621df0dff336d7c4c0517c792488ef3cf11cd37e72ab80f3a7f0a0aa14bad677ac97cf22c87c6eb9518e58b98590e1c8c756b56240940f0e470c81612e - languageName: node - linkType: hard - -"data-urls@npm:^2.0.0": - version: 2.0.0 - resolution: "data-urls@npm:2.0.0" +"data-urls@npm:^3.0.2": + version: 3.0.2 + resolution: "data-urls@npm:3.0.2" dependencies: - abab: ^2.0.3 - whatwg-mimetype: ^2.3.0 - whatwg-url: ^8.0.0 - checksum: 97caf828aac25e25e04ba6869db0f99c75e6859bb5b424ada28d3e7841941ebf08ddff3c1b1bb4585986bd507a5d54c2a716853ea6cb98af877400e637393e71 + abab: ^2.0.6 + whatwg-mimetype: ^3.0.0 + whatwg-url: ^11.0.0 + checksum: 033fc3dd0fba6d24bc9a024ddcf9923691dd24f90a3d26f6545d6a2f71ec6956f93462f2cdf2183cc46f10dc01ed3bcb36731a8208456eb1a08147e571fe2a76 languageName: node linkType: hard @@ -7134,7 +7389,7 @@ __metadata: languageName: node linkType: hard -"decimal.js@npm:^10.2.1": +"decimal.js@npm:^10.4.2": version: 10.4.3 resolution: "decimal.js@npm:10.4.3" checksum: 796404dcfa9d1dbfdc48870229d57f788b48c21c603c3f6554a1c17c10195fc1024de338b0cf9e1efe0c7c167eeb18f04548979bcc5fdfabebb7cc0ae3287bae @@ -7164,6 +7419,18 @@ __metadata: languageName: node linkType: hard +"dedent@npm:^1.0.0": + version: 1.5.3 + resolution: "dedent@npm:1.5.3" + peerDependencies: + babel-plugin-macros: ^3.1.0 + peerDependenciesMeta: + babel-plugin-macros: + optional: true + checksum: 045b595557b2a8ea2eb9b0b4623d764e9a87326486fe2b61191b4342ed93dc01245644d8a09f3108a50c0ee7965f1eedd92e4a3a503ed89ea8e810566ea27f9a + languageName: node + linkType: hard + "deep-extend@npm:^0.6.0, deep-extend@npm:~0.6.0": version: 0.6.0 resolution: "deep-extend@npm:0.6.0" @@ -7347,13 +7614,6 @@ __metadata: languageName: node linkType: hard -"diff-sequences@npm:^27.5.1": - version: 27.5.1 - resolution: "diff-sequences@npm:27.5.1" - checksum: a00db5554c9da7da225db2d2638d85f8e41124eccbd56cbaefb3b276dcbb1c1c2ad851c32defe2055a54a4806f030656cbf6638105fd6ce97bb87b90b32a33ca - languageName: node - linkType: hard - "diff-sequences@npm:^29.6.3": version: 29.6.3 resolution: "diff-sequences@npm:29.6.3" @@ -7402,21 +7662,12 @@ __metadata: languageName: node linkType: hard -"domexception@npm:^1.0.1": - version: 1.0.1 - resolution: "domexception@npm:1.0.1" - dependencies: - webidl-conversions: ^4.0.2 - checksum: f564a9c0915dcb83ceefea49df14aaed106b1468fbe505119e8bcb0b77e242534f3aba861978537c0fc9dc6f35b176d0ffc77b3e342820fb27a8f215e7ae4d52 - languageName: node - linkType: hard - -"domexception@npm:^2.0.1": - version: 2.0.1 - resolution: "domexception@npm:2.0.1" +"domexception@npm:^4.0.0": + version: 4.0.0 + resolution: "domexception@npm:4.0.0" dependencies: - webidl-conversions: ^5.0.0 - checksum: d638e9cb05c52999f1b2eb87c374b03311ea5b1d69c2f875bc92da73e17db60c12142b45c950228642ff7f845c536b65305483350d080df59003a653da80b691 + webidl-conversions: ^7.0.0 + checksum: ddbc1268edf33a8ba02ccc596735ede80375ee0cf124b30d2f05df5b464ba78ef4f49889b6391df4a04954e63d42d5631c7fcf8b1c4f12bc531252977a5f13d5 languageName: node linkType: hard @@ -7471,16 +7722,6 @@ __metadata: languageName: node linkType: hard -"ecc-jsbn@npm:~0.1.1": - version: 0.1.2 - resolution: "ecc-jsbn@npm:0.1.2" - dependencies: - jsbn: ~0.1.0 - safer-buffer: ^2.1.0 - checksum: 22fef4b6203e5f31d425f5b711eb389e4c6c2723402e389af394f8411b76a488fa414d309d866e2b577ce3e8462d344205545c88a8143cc21752a5172818888a - languageName: node - linkType: hard - "ee-first@npm:1.1.1": version: 1.1.1 resolution: "ee-first@npm:1.1.1" @@ -7495,6 +7736,17 @@ __metadata: languageName: node linkType: hard +"ejs@npm:^3.1.10": + version: 3.1.10 + resolution: "ejs@npm:3.1.10" + dependencies: + jake: ^10.8.5 + bin: + ejs: bin/cli.js + checksum: ce90637e9c7538663ae023b8a7a380b2ef7cc4096de70be85abf5a3b9641912dde65353211d05e24d56b1f242d71185c6d00e02cb8860701d571786d92c71f05 + languageName: node + linkType: hard + "ejs@npm:^3.1.7": version: 3.1.9 resolution: "ejs@npm:3.1.9" @@ -7513,6 +7765,13 @@ __metadata: languageName: node linkType: hard +"electron-to-chromium@npm:^1.5.41": + version: 1.5.65 + resolution: "electron-to-chromium@npm:1.5.65" + checksum: 4a112a038771c415f77e88fb3e3d929ceac4600b4612c55eb5d955a37c24842725f00c14f0f6838fd46edd832351c702b24c592c544d2e1e630d084f9df9f275 + languageName: node + linkType: hard + "elliptic@npm:6.5.4, elliptic@npm:^6.4.0, elliptic@npm:^6.5.4": version: 6.5.4 resolution: "elliptic@npm:6.5.4" @@ -7528,10 +7787,10 @@ __metadata: languageName: node linkType: hard -"emittery@npm:^0.8.1": - version: 0.8.1 - resolution: "emittery@npm:0.8.1" - checksum: 2457e8c7b0688bb006126f2c025b2655abe682f66b184954122a8a065b5277f9813d49d627896a10b076b81c513ec5f491fd9c14fbd42c04b95ca3c9f3c365ee +"emittery@npm:^0.13.1": + version: 0.13.1 + resolution: "emittery@npm:0.13.1" + checksum: 2b089ab6306f38feaabf4f6f02792f9ec85fc054fda79f44f6790e61bbf6bc4e1616afb9b232e0c5ec5289a8a452f79bfa6d905a6fd64e94b49981f0934001c6 languageName: node linkType: hard @@ -7611,6 +7870,13 @@ __metadata: languageName: node linkType: hard +"entities@npm:^4.5.0": + version: 4.5.0 + resolution: "entities@npm:4.5.0" + checksum: 853f8ebd5b425d350bffa97dd6958143179a5938352ccae092c62d1267c4e392a039be1bae7d51b6e4ffad25f51f9617531fedf5237f15df302ccfb452cbf2d7 + languageName: node + linkType: hard + "env-ci@npm:^5.0.1": version: 5.5.0 resolution: "env-ci@npm:5.5.0" @@ -8143,6 +8409,13 @@ __metadata: languageName: node linkType: hard +"escalade@npm:^3.2.0": + version: 3.2.0 + resolution: "escalade@npm:3.2.0" + checksum: 47b029c83de01b0d17ad99ed766347b974b0d628e848de404018f3abee728e987da0d2d370ad4574aa3d5b5bfc368754fd085d69a30f8e75903486ec4b5b709e + languageName: node + linkType: hard + "escape-html@npm:~1.0.3": version: 1.0.3 resolution: "escape-html@npm:1.0.3" @@ -8171,25 +8444,6 @@ __metadata: languageName: node linkType: hard -"escodegen@npm:^1.11.1": - version: 1.14.3 - resolution: "escodegen@npm:1.14.3" - dependencies: - esprima: ^4.0.1 - estraverse: ^4.2.0 - esutils: ^2.0.2 - optionator: ^0.8.1 - source-map: ~0.6.1 - dependenciesMeta: - source-map: - optional: true - bin: - escodegen: bin/escodegen.js - esgenerate: bin/esgenerate.js - checksum: 381cdc4767ecdb221206bbbab021b467bbc2a6f5c9a99c9e6353040080bdd3dfe73d7604ad89a47aca6ea7d58bc635f6bd3fbc8da9a1998e9ddfa8372362ccd0 - languageName: node - linkType: hard - "escodegen@npm:^2.0.0": version: 2.0.0 resolution: "escodegen@npm:2.0.0" @@ -8525,13 +8779,6 @@ __metadata: languageName: node linkType: hard -"estraverse@npm:^4.2.0": - version: 4.3.0 - resolution: "estraverse@npm:4.3.0" - checksum: a6299491f9940bb246124a8d44b7b7a413a8336f5436f9837aaa9330209bd9ee8af7e91a654a3545aee9c54b3308e78ee360cef1d777d37cfef77d2fa33b5827 - languageName: node - linkType: hard - "estraverse@npm:^5.1.0, estraverse@npm:^5.2.0, estraverse@npm:^5.3.0": version: 5.3.0 resolution: "estraverse@npm:5.3.0" @@ -8783,15 +9030,16 @@ __metadata: languageName: node linkType: hard -"expect@npm:^27.5.1": - version: 27.5.1 - resolution: "expect@npm:27.5.1" +"expect@npm:^29.0.0, expect@npm:^29.7.0": + version: 29.7.0 + resolution: "expect@npm:29.7.0" dependencies: - "@jest/types": ^27.5.1 - jest-get-type: ^27.5.1 - jest-matcher-utils: ^27.5.1 - jest-message-util: ^27.5.1 - checksum: b2c66beb52de53ef1872165aace40224e722bca3c2274c54cfa74b6d617d55cf0ccdbf36783ccd64dbea501b280098ed33fd0b207d4f15bc03cd3c7a24364a6a + "@jest/expect-utils": ^29.7.0 + jest-get-type: ^29.6.3 + jest-matcher-utils: ^29.7.0 + jest-message-util: ^29.7.0 + jest-util: ^29.7.0 + checksum: 9257f10288e149b81254a0fda8ffe8d54a7061cd61d7515779998b012579d2b8c22354b0eb901daf0145f347403da582f75f359f4810c007182ad3fb318b5c0c languageName: node linkType: hard @@ -8870,13 +9118,6 @@ __metadata: languageName: node linkType: hard -"extend@npm:~3.0.2": - version: 3.0.2 - resolution: "extend@npm:3.0.2" - checksum: a50a8309ca65ea5d426382ff09f33586527882cf532931cb08ca786ea3146c0553310bda688710ff61d7668eba9f96b923fe1420cdf56a2c3eaf30fcab87b515 - languageName: node - linkType: hard - "external-editor@npm:^2.0.4": version: 2.2.0 resolution: "external-editor@npm:2.2.0" @@ -8915,20 +9156,6 @@ __metadata: languageName: node linkType: hard -"extsprintf@npm:1.3.0": - version: 1.3.0 - resolution: "extsprintf@npm:1.3.0" - checksum: cee7a4a1e34cffeeec18559109de92c27517e5641991ec6bab849aa64e3081022903dd53084f2080d0d2530803aa5ee84f1e9de642c365452f9e67be8f958ce2 - languageName: node - linkType: hard - -"extsprintf@npm:^1.2.0": - version: 1.4.1 - resolution: "extsprintf@npm:1.4.1" - checksum: a2f29b241914a8d2bad64363de684821b6b1609d06ae68d5b539e4de6b28659715b5bea94a7265201603713b7027d35399d10b0548f09071c5513e65e8323d33 - languageName: node - linkType: hard - "eyes@npm:^0.1.8": version: 0.1.8 resolution: "eyes@npm:0.1.8" @@ -8995,7 +9222,7 @@ __metadata: languageName: node linkType: hard -"fast-json-stable-stringify@npm:2.x, fast-json-stable-stringify@npm:^2.0.0": +"fast-json-stable-stringify@npm:2.x, fast-json-stable-stringify@npm:^2.0.0, fast-json-stable-stringify@npm:^2.1.0": version: 2.1.0 resolution: "fast-json-stable-stringify@npm:2.1.0" checksum: b191531e36c607977e5b1c47811158733c34ccb3bfde92c44798929e9b4154884378536d26ad90dfecd32e1ffc09c545d23535ad91b3161a27ddbb8ebe0cbecb @@ -9294,13 +9521,6 @@ __metadata: languageName: node linkType: hard -"forever-agent@npm:~0.6.1": - version: 0.6.1 - resolution: "forever-agent@npm:0.6.1" - checksum: 766ae6e220f5fe23676bb4c6a99387cec5b7b62ceb99e10923376e27bfea72f3c3aeec2ba5f45f3f7ba65d6616965aa7c20b15002b6860833bb6e394dea546a8 - languageName: node - linkType: hard - "form-data@npm:4.0.0, form-data@npm:^4.0.0": version: 4.0.0 resolution: "form-data@npm:4.0.0" @@ -9312,28 +9532,6 @@ __metadata: languageName: node linkType: hard -"form-data@npm:^3.0.0": - version: 3.0.1 - resolution: "form-data@npm:3.0.1" - dependencies: - asynckit: ^0.4.0 - combined-stream: ^1.0.8 - mime-types: ^2.1.12 - checksum: b019e8d35c8afc14a2bd8a7a92fa4f525a4726b6d5a9740e8d2623c30e308fbb58dc8469f90415a856698933c8479b01646a9dff33c87cc4e76d72aedbbf860d - languageName: node - linkType: hard - -"form-data@npm:~2.3.2": - version: 2.3.3 - resolution: "form-data@npm:2.3.3" - dependencies: - asynckit: ^0.4.0 - combined-stream: ^1.0.6 - mime-types: ^2.1.12 - checksum: 10c1780fa13dbe1ff3100114c2ce1f9307f8be10b14bf16e103815356ff567b6be39d70fc4a40f8990b9660012dc24b0f5e1dde1b6426166eb23a445ba068ca3 - languageName: node - linkType: hard - "fp-ts@npm:^2.5.3": version: 2.13.1 resolution: "fp-ts@npm:2.13.1" @@ -9725,15 +9923,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"getpass@npm:^0.1.1": - version: 0.1.7 - resolution: "getpass@npm:0.1.7" - dependencies: - assert-plus: ^1.0.0 - checksum: ab18d55661db264e3eac6012c2d3daeafaab7a501c035ae0ccb193c3c23e9849c6e29b6ac762b9c2adae460266f925d55a3a2a3a3c8b94be2f222df94d70c046 - languageName: node - linkType: hard - "git-raw-commits@npm:^3.0.0": version: 3.0.0 resolution: "git-raw-commits@npm:3.0.0" @@ -9840,7 +10029,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"glob@npm:^7.1.1, glob@npm:^7.1.2, glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.2.0": +"glob@npm:^7.1.2, glob@npm:^7.1.3, glob@npm:^7.1.4, glob@npm:^7.2.0": version: 7.2.3 resolution: "glob@npm:7.2.3" dependencies: @@ -10023,23 +10212,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"har-schema@npm:^2.0.0": - version: 2.0.0 - resolution: "har-schema@npm:2.0.0" - checksum: d8946348f333fb09e2bf24cc4c67eabb47c8e1d1aa1c14184c7ffec1140a49ec8aa78aa93677ae452d71d5fc0fdeec20f0c8c1237291fc2bcb3f502a5d204f9b - languageName: node - linkType: hard - -"har-validator@npm:~5.1.3": - version: 5.1.5 - resolution: "har-validator@npm:5.1.5" - dependencies: - ajv: ^6.12.3 - har-schema: ^2.0.0 - checksum: b998a7269ca560d7f219eedc53e2c664cd87d487e428ae854a6af4573fc94f182fe9d2e3b92ab968249baec7ebaf9ead69cf975c931dc2ab282ec182ee988280 - languageName: node - linkType: hard - "hard-rejection@npm:^2.1.0": version: 2.1.0 resolution: "hard-rejection@npm:2.1.0" @@ -10289,21 +10461,12 @@ fsevents@^2.3.2: languageName: node linkType: hard -"html-encoding-sniffer@npm:^1.0.2": - version: 1.0.2 - resolution: "html-encoding-sniffer@npm:1.0.2" - dependencies: - whatwg-encoding: ^1.0.1 - checksum: b874df6750451b7642fbe8e998c6bdd2911b0f42ad2927814b717bf1f4b082b0904b6178a1bfbc40117bf5799777993b0825e7713ca0fca49844e5aec03aa0e2 - languageName: node - linkType: hard - -"html-encoding-sniffer@npm:^2.0.1": - version: 2.0.1 - resolution: "html-encoding-sniffer@npm:2.0.1" +"html-encoding-sniffer@npm:^3.0.0": + version: 3.0.0 + resolution: "html-encoding-sniffer@npm:3.0.0" dependencies: - whatwg-encoding: ^1.0.5 - checksum: bf30cce461015ed7e365736fcd6a3063c7bc016a91f74398ef6158886970a96333938f7c02417ab3c12aa82e3e53b40822145facccb9ddfbcdc15a879ae4d7ba + whatwg-encoding: ^2.0.0 + checksum: 8d806aa00487e279e5ccb573366a951a9f68f65c90298eac9c3a2b440a7ffe46615aff2995a2f61c6746c639234e6179a97e18ca5ccbbf93d3725ef2099a4502 languageName: node linkType: hard @@ -10341,17 +10504,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"http-proxy-agent@npm:^4.0.1": - version: 4.0.1 - resolution: "http-proxy-agent@npm:4.0.1" - dependencies: - "@tootallnate/once": 1 - agent-base: 6 - debug: 4 - checksum: c6a5da5a1929416b6bbdf77b1aca13888013fe7eb9d59fc292e25d18e041bb154a8dfada58e223fc7b76b9b2d155a87e92e608235201f77d34aa258707963a82 - languageName: node - linkType: hard - "http-proxy-agent@npm:^5.0.0": version: 5.0.0 resolution: "http-proxy-agent@npm:5.0.0" @@ -10373,18 +10525,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"http-signature@npm:~1.2.0": - version: 1.2.0 - resolution: "http-signature@npm:1.2.0" - dependencies: - assert-plus: ^1.0.0 - jsprim: ^1.2.2 - sshpk: ^1.7.0 - checksum: 3324598712266a9683585bb84a75dec4fd550567d5e0dd4a0fff6ff3f74348793404d3eeac4918fa0902c810eeee1a86419e4a2e92a164132dfe6b26743fb47c - languageName: node - linkType: hard - -"https-proxy-agent@npm:^5.0.0": +"https-proxy-agent@npm:^5.0.0, https-proxy-agent@npm:^5.0.1": version: 5.0.1 resolution: "https-proxy-agent@npm:5.0.1" dependencies: @@ -10436,16 +10577,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"iconv-lite@npm:0.4.24, iconv-lite@npm:^0.4.17, iconv-lite@npm:^0.4.24": - version: 0.4.24 - resolution: "iconv-lite@npm:0.4.24" - dependencies: - safer-buffer: ">= 2.1.2 < 3" - checksum: bd9f120f5a5b306f0bc0b9ae1edeb1577161503f5f8252a20f1a9e56ef8775c9959fd01c55f2d3a39d9a8abaf3e30c1abeb1895f367dcbbe0a8fd1c9ca01c4f6 - languageName: node - linkType: hard - -"iconv-lite@npm:^0.6.2": +"iconv-lite@npm:0.6.3, iconv-lite@npm:^0.6.2": version: 0.6.3 resolution: "iconv-lite@npm:0.6.3" dependencies: @@ -10454,6 +10586,15 @@ fsevents@^2.3.2: languageName: node linkType: hard +"iconv-lite@npm:^0.4.17, iconv-lite@npm:^0.4.24": + version: 0.4.24 + resolution: "iconv-lite@npm:0.4.24" + dependencies: + safer-buffer: ">= 2.1.2 < 3" + checksum: bd9f120f5a5b306f0bc0b9ae1edeb1577161503f5f8252a20f1a9e56ef8775c9959fd01c55f2d3a39d9a8abaf3e30c1abeb1895f367dcbbe0a8fd1c9ca01c4f6 + languageName: node + linkType: hard + "ieee754@npm:^1.1.13, ieee754@npm:^1.2.1": version: 1.2.1 resolution: "ieee754@npm:1.2.1" @@ -10748,13 +10889,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"ip-regex@npm:^2.1.0": - version: 2.1.0 - resolution: "ip-regex@npm:2.1.0" - checksum: 331d95052aa53ce245745ea0fc3a6a1e2e3c8d6da65fa8ea52bf73768c1b22a9ac50629d1d2b08c04e7b3ac4c21b536693c149ce2c2615ee4796030e5b3e3cba - languageName: node - linkType: hard - "ip@npm:^1.1.5": version: 1.1.8 resolution: "ip@npm:1.1.8" @@ -11325,7 +11459,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"is-typedarray@npm:^1.0.0, is-typedarray@npm:~1.0.0": +"is-typedarray@npm:^1.0.0": version: 1.0.0 resolution: "is-typedarray@npm:1.0.0" checksum: 3508c6cd0a9ee2e0df2fa2e9baabcdc89e911c7bd5cf64604586697212feec525aa21050e48affb5ffc3df20f0f5d2e2cf79b08caa64e1ccc9578e251763aef7 @@ -11451,13 +11585,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"isstream@npm:~0.1.2": - version: 0.1.2 - resolution: "isstream@npm:0.1.2" - checksum: 1eb2fe63a729f7bdd8a559ab552c69055f4f48eb5c2f03724430587c6f450783c8f1cd936c1c952d0a927925180fcc892ebd5b174236cf1065d4bd5bdb37e963 - languageName: node - linkType: hard - "istanbul-lib-coverage@npm:^2.0.1, istanbul-lib-coverage@npm:^2.0.5": version: 2.0.5 resolution: "istanbul-lib-coverage@npm:2.0.5" @@ -11496,7 +11623,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"istanbul-lib-instrument@npm:^5.0.4, istanbul-lib-instrument@npm:^5.1.0": +"istanbul-lib-instrument@npm:^5.0.4": version: 5.2.1 resolution: "istanbul-lib-instrument@npm:5.2.1" dependencies: @@ -11509,6 +11636,19 @@ fsevents@^2.3.2: languageName: node linkType: hard +"istanbul-lib-instrument@npm:^6.0.0": + version: 6.0.3 + resolution: "istanbul-lib-instrument@npm:6.0.3" + dependencies: + "@babel/core": ^7.23.9 + "@babel/parser": ^7.23.9 + "@istanbuljs/schema": ^0.1.3 + istanbul-lib-coverage: ^3.2.0 + semver: ^7.5.4 + checksum: 74104c60c65c4fa0e97cc76f039226c356123893929f067bfad5f86fe839e08f5d680354a68fead3bc9c1e2f3fa6f3f53cded70778e821d911e851d349f3545a + languageName: node + linkType: hard + "istanbul-lib-report@npm:^2.0.2": version: 2.0.8 resolution: "istanbul-lib-report@npm:2.0.8" @@ -11661,60 +11801,60 @@ fsevents@^2.3.2: languageName: node linkType: hard -"jest-changed-files@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-changed-files@npm:27.5.1" +"jest-changed-files@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-changed-files@npm:29.7.0" dependencies: - "@jest/types": ^27.5.1 execa: ^5.0.0 - throat: ^6.0.1 - checksum: 95e9dc74c3ca688ef85cfeab270f43f8902721a6c8ade6ac2459459a77890c85977f537d6fb809056deaa6d9c3f075fa7d2699ff5f3bf7d3fda17c3760b79b15 + jest-util: ^29.7.0 + p-limit: ^3.1.0 + checksum: 963e203893c396c5dfc75e00a49426688efea7361b0f0e040035809cecd2d46b3c01c02be2d9e8d38b1138357d2de7719ea5b5be21f66c10f2e9685a5a73bb99 languageName: node linkType: hard -"jest-circus@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-circus@npm:27.5.1" +"jest-circus@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-circus@npm:29.7.0" dependencies: - "@jest/environment": ^27.5.1 - "@jest/test-result": ^27.5.1 - "@jest/types": ^27.5.1 + "@jest/environment": ^29.7.0 + "@jest/expect": ^29.7.0 + "@jest/test-result": ^29.7.0 + "@jest/types": ^29.6.3 "@types/node": "*" chalk: ^4.0.0 co: ^4.6.0 - dedent: ^0.7.0 - expect: ^27.5.1 + dedent: ^1.0.0 is-generator-fn: ^2.0.0 - jest-each: ^27.5.1 - jest-matcher-utils: ^27.5.1 - jest-message-util: ^27.5.1 - jest-runtime: ^27.5.1 - jest-snapshot: ^27.5.1 - jest-util: ^27.5.1 - pretty-format: ^27.5.1 + jest-each: ^29.7.0 + jest-matcher-utils: ^29.7.0 + jest-message-util: ^29.7.0 + jest-runtime: ^29.7.0 + jest-snapshot: ^29.7.0 + jest-util: ^29.7.0 + p-limit: ^3.1.0 + pretty-format: ^29.7.0 + pure-rand: ^6.0.0 slash: ^3.0.0 stack-utils: ^2.0.3 - throat: ^6.0.1 - checksum: 6192dccbccb3a6acfa361cbb97bdbabe94864ccf3d885932cfd41f19534329d40698078cf9be1489415e8234255d6ea9f9aff5396b79ad842a6fca6e6fc08fd0 + checksum: 349437148924a5a109c9b8aad6d393a9591b4dac1918fc97d81b7fc515bc905af9918495055071404af1fab4e48e4b04ac3593477b1d5dcf48c4e71b527c70a7 languageName: node linkType: hard -"jest-cli@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-cli@npm:27.5.1" +"jest-cli@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-cli@npm:29.7.0" dependencies: - "@jest/core": ^27.5.1 - "@jest/test-result": ^27.5.1 - "@jest/types": ^27.5.1 + "@jest/core": ^29.7.0 + "@jest/test-result": ^29.7.0 + "@jest/types": ^29.6.3 chalk: ^4.0.0 + create-jest: ^29.7.0 exit: ^0.1.2 - graceful-fs: ^4.2.9 import-local: ^3.0.2 - jest-config: ^27.5.1 - jest-util: ^27.5.1 - jest-validate: ^27.5.1 - prompts: ^2.0.1 - yargs: ^16.2.0 + jest-config: ^29.7.0 + jest-util: ^29.7.0 + jest-validate: ^29.7.0 + yargs: ^17.3.1 peerDependencies: node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 peerDependenciesMeta: @@ -11722,44 +11862,45 @@ fsevents@^2.3.2: optional: true bin: jest: bin/jest.js - checksum: 6c0a69fb48e500241409e09ff743ed72bc6578d7769e2c994724e7ef1e5587f6c1f85dc429e93b98ae38a365222993ee70f0acc2199358992120900984f349e5 + checksum: 664901277a3f5007ea4870632ed6e7889db9da35b2434e7cb488443e6bf5513889b344b7fddf15112135495b9875892b156faeb2d7391ddb9e2a849dcb7b6c36 languageName: node linkType: hard -"jest-config@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-config@npm:27.5.1" +"jest-config@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-config@npm:29.7.0" dependencies: - "@babel/core": ^7.8.0 - "@jest/test-sequencer": ^27.5.1 - "@jest/types": ^27.5.1 - babel-jest: ^27.5.1 + "@babel/core": ^7.11.6 + "@jest/test-sequencer": ^29.7.0 + "@jest/types": ^29.6.3 + babel-jest: ^29.7.0 chalk: ^4.0.0 ci-info: ^3.2.0 deepmerge: ^4.2.2 - glob: ^7.1.1 + glob: ^7.1.3 graceful-fs: ^4.2.9 - jest-circus: ^27.5.1 - jest-environment-jsdom: ^27.5.1 - jest-environment-node: ^27.5.1 - jest-get-type: ^27.5.1 - jest-jasmine2: ^27.5.1 - jest-regex-util: ^27.5.1 - jest-resolve: ^27.5.1 - jest-runner: ^27.5.1 - jest-util: ^27.5.1 - jest-validate: ^27.5.1 + jest-circus: ^29.7.0 + jest-environment-node: ^29.7.0 + jest-get-type: ^29.6.3 + jest-regex-util: ^29.6.3 + jest-resolve: ^29.7.0 + jest-runner: ^29.7.0 + jest-util: ^29.7.0 + jest-validate: ^29.7.0 micromatch: ^4.0.4 parse-json: ^5.2.0 - pretty-format: ^27.5.1 + pretty-format: ^29.7.0 slash: ^3.0.0 strip-json-comments: ^3.1.1 peerDependencies: + "@types/node": "*" ts-node: ">=9.0.0" peerDependenciesMeta: + "@types/node": + optional: true ts-node: optional: true - checksum: 1188fd46c0ed78cbe3175eb9ad6712ccf74a74be33d9f0d748e147c107f0889f8b701fbff1567f31836ae18597dacdc43d6a8fc30dd34ade6c9229cc6c7cb82d + checksum: 4cabf8f894c180cac80b7df1038912a3fc88f96f2622de33832f4b3314f83e22b08fb751da570c0ab2b7988f21604bdabade95e3c0c041068ac578c085cf7dff languageName: node linkType: hard @@ -11775,66 +11916,60 @@ fsevents@^2.3.2: languageName: node linkType: hard -"jest-diff@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-diff@npm:27.5.1" - dependencies: - chalk: ^4.0.0 - diff-sequences: ^27.5.1 - jest-get-type: ^27.5.1 - pretty-format: ^27.5.1 - checksum: 8be27c1e1ee57b2bb2bef9c0b233c19621b4c43d53a3c26e2c00a4e805eb4ea11fe1694a06a9fb0e80ffdcfdc0d2b1cb0b85920b3f5c892327ecd1e7bd96b865 - languageName: node - linkType: hard - -"jest-docblock@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-docblock@npm:27.5.1" +"jest-docblock@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-docblock@npm:29.7.0" dependencies: detect-newline: ^3.0.0 - checksum: c0fed6d55b229d8bffdd8d03f121dd1a3be77c88f50552d374f9e1ea3bde57bf6bea017a0add04628d98abcb1bfb48b456438eeca8a74ef0053f4dae3b95d29c + checksum: 66390c3e9451f8d96c5da62f577a1dad701180cfa9b071c5025acab2f94d7a3efc2515cfa1654ebe707213241541ce9c5530232cdc8017c91ed64eea1bd3b192 languageName: node linkType: hard -"jest-each@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-each@npm:27.5.1" +"jest-each@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-each@npm:29.7.0" dependencies: - "@jest/types": ^27.5.1 + "@jest/types": ^29.6.3 chalk: ^4.0.0 - jest-get-type: ^27.5.1 - jest-util: ^27.5.1 - pretty-format: ^27.5.1 - checksum: b5a6d8730fd938982569c9e0b42bdf3c242f97b957ed8155a6473b5f7b540970f8685524e7f53963dc1805319f4b6602abfc56605590ca19d55bd7a87e467e63 + jest-get-type: ^29.6.3 + jest-util: ^29.7.0 + pretty-format: ^29.7.0 + checksum: e88f99f0184000fc8813f2a0aa79e29deeb63700a3b9b7928b8a418d7d93cd24933608591dbbdea732b473eb2021c72991b5cc51a17966842841c6e28e6f691c languageName: node linkType: hard -"jest-environment-jsdom@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-environment-jsdom@npm:27.5.1" +"jest-environment-jsdom@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-environment-jsdom@npm:29.7.0" dependencies: - "@jest/environment": ^27.5.1 - "@jest/fake-timers": ^27.5.1 - "@jest/types": ^27.5.1 + "@jest/environment": ^29.7.0 + "@jest/fake-timers": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/jsdom": ^20.0.0 "@types/node": "*" - jest-mock: ^27.5.1 - jest-util: ^27.5.1 - jsdom: ^16.6.0 - checksum: bc104aef7d7530d0740402aa84ac812138b6d1e51fe58adecce679f82b99340ddab73e5ec68fa079f33f50c9ddec9728fc9f0ddcca2ad6f0b351eed2762cc555 + jest-mock: ^29.7.0 + jest-util: ^29.7.0 + jsdom: ^20.0.0 + peerDependencies: + canvas: ^2.5.0 + peerDependenciesMeta: + canvas: + optional: true + checksum: 559aac134c196fccc1dfc794d8fc87377e9f78e894bb13012b0831d88dec0abd7ece99abec69da564b8073803be4f04a9eb4f4d1bb80e29eec0cb252c254deb8 languageName: node linkType: hard -"jest-environment-node@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-environment-node@npm:27.5.1" +"jest-environment-node@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-environment-node@npm:29.7.0" dependencies: - "@jest/environment": ^27.5.1 - "@jest/fake-timers": ^27.5.1 - "@jest/types": ^27.5.1 + "@jest/environment": ^29.7.0 + "@jest/fake-timers": ^29.7.0 + "@jest/types": ^29.6.3 "@types/node": "*" - jest-mock: ^27.5.1 - jest-util: ^27.5.1 - checksum: 0f988330c4f3eec092e3fb37ea753b0c6f702e83cd8f4d770af9c2bf964a70bc45fbd34ec6fdb6d71ce98a778d9f54afd673e63f222e4667fff289e8069dba39 + jest-mock: ^29.7.0 + jest-util: ^29.7.0 + checksum: 501a9966292cbe0ca3f40057a37587cb6def25e1e0c5e39ac6c650fe78d3c70a2428304341d084ac0cced5041483acef41c477abac47e9a290d5545fd2f15646 languageName: node linkType: hard @@ -11845,13 +11980,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"jest-get-type@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-get-type@npm:27.5.1" - checksum: 63064ab70195c21007d897c1157bf88ff94a790824a10f8c890392e7d17eda9c3900513cb291ca1c8d5722cad79169764e9a1279f7c8a9c4cd6e9109ff04bbc0 - languageName: node - linkType: hard - "jest-get-type@npm:^29.6.3": version: 29.6.3 resolution: "jest-get-type@npm:29.6.3" @@ -11906,50 +12034,36 @@ fsevents@^2.3.2: languageName: node linkType: hard -"jest-jasmine2@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-jasmine2@npm:27.5.1" +"jest-haste-map@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-haste-map@npm:29.7.0" dependencies: - "@jest/environment": ^27.5.1 - "@jest/source-map": ^27.5.1 - "@jest/test-result": ^27.5.1 - "@jest/types": ^27.5.1 + "@jest/types": ^29.6.3 + "@types/graceful-fs": ^4.1.3 "@types/node": "*" - chalk: ^4.0.0 - co: ^4.6.0 - expect: ^27.5.1 - is-generator-fn: ^2.0.0 - jest-each: ^27.5.1 - jest-matcher-utils: ^27.5.1 - jest-message-util: ^27.5.1 - jest-runtime: ^27.5.1 - jest-snapshot: ^27.5.1 - jest-util: ^27.5.1 - pretty-format: ^27.5.1 - throat: ^6.0.1 - checksum: b716adf253ceb73db661936153394ab90d7f3a8ba56d6189b7cd4df8e4e2a4153b4e63ebb5d36e29ceb0f4c211d5a6f36ab7048c6abbd881c8646567e2ab8e6d - languageName: node - linkType: hard - -"jest-leak-detector@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-leak-detector@npm:27.5.1" - dependencies: - jest-get-type: ^27.5.1 - pretty-format: ^27.5.1 - checksum: 5c9689060960567ddaf16c570d87afa760a461885765d2c71ef4f4857bbc3af1482c34e3cce88e50beefde1bf35e33530b020480752057a7e3dbb1ca0bae359f + anymatch: ^3.0.3 + fb-watchman: ^2.0.0 + fsevents: ^2.3.2 + graceful-fs: ^4.2.9 + jest-regex-util: ^29.6.3 + jest-util: ^29.7.0 + jest-worker: ^29.7.0 + micromatch: ^4.0.4 + walker: ^1.0.8 + dependenciesMeta: + fsevents: + optional: true + checksum: c2c8f2d3e792a963940fbdfa563ce14ef9e14d4d86da645b96d3cd346b8d35c5ce0b992ee08593939b5f718cf0a1f5a90011a056548a1dbf58397d4356786f01 languageName: node linkType: hard -"jest-matcher-utils@npm:^27.0.0, jest-matcher-utils@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-matcher-utils@npm:27.5.1" +"jest-leak-detector@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-leak-detector@npm:29.7.0" dependencies: - chalk: ^4.0.0 - jest-diff: ^27.5.1 - jest-get-type: ^27.5.1 - pretty-format: ^27.5.1 - checksum: bb2135fc48889ff3fe73888f6cc7168ddab9de28b51b3148f820c89fdfd2effdcad005f18be67d0b9be80eda208ad47290f62f03d0a33f848db2dd0273c8217a + jest-get-type: ^29.6.3 + pretty-format: ^29.7.0 + checksum: e3950e3ddd71e1d0c22924c51a300a1c2db6cf69ec1e51f95ccf424bcc070f78664813bef7aed4b16b96dfbdeea53fe358f8aeaaea84346ae15c3735758f1605 languageName: node linkType: hard @@ -11981,20 +12095,20 @@ fsevents@^2.3.2: languageName: node linkType: hard -"jest-message-util@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-message-util@npm:27.5.1" +"jest-message-util@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-message-util@npm:29.7.0" dependencies: "@babel/code-frame": ^7.12.13 - "@jest/types": ^27.5.1 + "@jest/types": ^29.6.3 "@types/stack-utils": ^2.0.0 chalk: ^4.0.0 graceful-fs: ^4.2.9 micromatch: ^4.0.4 - pretty-format: ^27.5.1 + pretty-format: ^29.7.0 slash: ^3.0.0 stack-utils: ^2.0.3 - checksum: eb6d637d1411c71646de578c49826b6da8e33dd293e501967011de9d1916d53d845afbfb52a5b661ff1c495be7c13f751c48c7f30781fd94fbd64842e8195796 + checksum: a9d025b1c6726a2ff17d54cc694de088b0489456c69106be6b615db7a51b7beb66788bea7a59991a019d924fbf20f67d085a445aedb9a4d6760363f4d7d09930 languageName: node linkType: hard @@ -12007,13 +12121,14 @@ fsevents@^2.3.2: languageName: node linkType: hard -"jest-mock@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-mock@npm:27.5.1" +"jest-mock@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-mock@npm:29.7.0" dependencies: - "@jest/types": ^27.5.1 + "@jest/types": ^29.6.3 "@types/node": "*" - checksum: f5b5904bb1741b4a1687a5f492535b7b1758dc26534c72a5423305f8711292e96a601dec966df81bb313269fb52d47227e29f9c2e08324d79529172f67311be0 + jest-util: ^29.7.0 + checksum: 81ba9b68689a60be1482212878973700347cb72833c5e5af09895882b9eb5c4e02843a1bbdf23f94c52d42708bab53a30c45a3482952c9eec173d1eaac5b86c5 languageName: node linkType: hard @@ -12036,91 +12151,96 @@ fsevents@^2.3.2: languageName: node linkType: hard -"jest-resolve-dependencies@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-resolve-dependencies@npm:27.5.1" +"jest-regex-util@npm:^29.6.3": + version: 29.6.3 + resolution: "jest-regex-util@npm:29.6.3" + checksum: 0518beeb9bf1228261695e54f0feaad3606df26a19764bc19541e0fc6e2a3737191904607fb72f3f2ce85d9c16b28df79b7b1ec9443aa08c3ef0e9efda6f8f2a + languageName: node + linkType: hard + +"jest-resolve-dependencies@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-resolve-dependencies@npm:29.7.0" dependencies: - "@jest/types": ^27.5.1 - jest-regex-util: ^27.5.1 - jest-snapshot: ^27.5.1 - checksum: c67af97afad1da88f5530317c732bbd1262d1225f6cd7f4e4740a5db48f90ab0bd8564738ac70d1a43934894f9aef62205c1b8f8ee89e5c7a737e6a121ee4c25 + jest-regex-util: ^29.6.3 + jest-snapshot: ^29.7.0 + checksum: aeb75d8150aaae60ca2bb345a0d198f23496494677cd6aefa26fc005faf354061f073982175daaf32b4b9d86b26ca928586344516e3e6969aa614cb13b883984 languageName: node linkType: hard -"jest-resolve@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-resolve@npm:27.5.1" +"jest-resolve@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-resolve@npm:29.7.0" dependencies: - "@jest/types": ^27.5.1 chalk: ^4.0.0 graceful-fs: ^4.2.9 - jest-haste-map: ^27.5.1 + jest-haste-map: ^29.7.0 jest-pnp-resolver: ^1.2.2 - jest-util: ^27.5.1 - jest-validate: ^27.5.1 + jest-util: ^29.7.0 + jest-validate: ^29.7.0 resolve: ^1.20.0 - resolve.exports: ^1.1.0 + resolve.exports: ^2.0.0 slash: ^3.0.0 - checksum: 735830e7265b20a348029738680bb2f6e37f80ecea86cda869a4c318ba3a45d39c7a3a873a22f7f746d86258c50ead6e7f501de043e201c095d7ba628a1c440f + checksum: 0ca218e10731aa17920526ec39deaec59ab9b966237905ffc4545444481112cd422f01581230eceb7e82d86f44a543d520a71391ec66e1b4ef1a578bd5c73487 languageName: node linkType: hard -"jest-runner@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-runner@npm:27.5.1" +"jest-runner@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-runner@npm:29.7.0" dependencies: - "@jest/console": ^27.5.1 - "@jest/environment": ^27.5.1 - "@jest/test-result": ^27.5.1 - "@jest/transform": ^27.5.1 - "@jest/types": ^27.5.1 + "@jest/console": ^29.7.0 + "@jest/environment": ^29.7.0 + "@jest/test-result": ^29.7.0 + "@jest/transform": ^29.7.0 + "@jest/types": ^29.6.3 "@types/node": "*" chalk: ^4.0.0 - emittery: ^0.8.1 + emittery: ^0.13.1 graceful-fs: ^4.2.9 - jest-docblock: ^27.5.1 - jest-environment-jsdom: ^27.5.1 - jest-environment-node: ^27.5.1 - jest-haste-map: ^27.5.1 - jest-leak-detector: ^27.5.1 - jest-message-util: ^27.5.1 - jest-resolve: ^27.5.1 - jest-runtime: ^27.5.1 - jest-util: ^27.5.1 - jest-worker: ^27.5.1 - source-map-support: ^0.5.6 - throat: ^6.0.1 - checksum: 5bbe6cf847dd322b3332ec9d6977b54f91bd5f72ff620bc1a0192f0f129deda8aa7ca74c98922187a7aa87d8e0ce4f6c50e99a7ccb2a310bf4d94be2e0c3ce8e + jest-docblock: ^29.7.0 + jest-environment-node: ^29.7.0 + jest-haste-map: ^29.7.0 + jest-leak-detector: ^29.7.0 + jest-message-util: ^29.7.0 + jest-resolve: ^29.7.0 + jest-runtime: ^29.7.0 + jest-util: ^29.7.0 + jest-watcher: ^29.7.0 + jest-worker: ^29.7.0 + p-limit: ^3.1.0 + source-map-support: 0.5.13 + checksum: f0405778ea64812bf9b5c50b598850d94ccf95d7ba21f090c64827b41decd680ee19fcbb494007cdd7f5d0d8906bfc9eceddd8fa583e753e736ecd462d4682fb languageName: node linkType: hard -"jest-runtime@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-runtime@npm:27.5.1" - dependencies: - "@jest/environment": ^27.5.1 - "@jest/fake-timers": ^27.5.1 - "@jest/globals": ^27.5.1 - "@jest/source-map": ^27.5.1 - "@jest/test-result": ^27.5.1 - "@jest/transform": ^27.5.1 - "@jest/types": ^27.5.1 +"jest-runtime@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-runtime@npm:29.7.0" + dependencies: + "@jest/environment": ^29.7.0 + "@jest/fake-timers": ^29.7.0 + "@jest/globals": ^29.7.0 + "@jest/source-map": ^29.6.3 + "@jest/test-result": ^29.7.0 + "@jest/transform": ^29.7.0 + "@jest/types": ^29.6.3 + "@types/node": "*" chalk: ^4.0.0 cjs-module-lexer: ^1.0.0 collect-v8-coverage: ^1.0.0 - execa: ^5.0.0 glob: ^7.1.3 graceful-fs: ^4.2.9 - jest-haste-map: ^27.5.1 - jest-message-util: ^27.5.1 - jest-mock: ^27.5.1 - jest-regex-util: ^27.5.1 - jest-resolve: ^27.5.1 - jest-snapshot: ^27.5.1 - jest-util: ^27.5.1 + jest-haste-map: ^29.7.0 + jest-message-util: ^29.7.0 + jest-mock: ^29.7.0 + jest-regex-util: ^29.6.3 + jest-resolve: ^29.7.0 + jest-snapshot: ^29.7.0 + jest-util: ^29.7.0 slash: ^3.0.0 strip-bom: ^4.0.0 - checksum: 929e3df0c53dab43f831f2af4e2996b22aa8cb2d6d483919d6b0426cbc100098fd5b777b998c6568b77f8c4d860b2e83127514292ff61416064f5ef926492386 + checksum: d19f113d013e80691e07047f68e1e3448ef024ff2c6b586ce4f90cd7d4c62a2cd1d460110491019719f3c59bfebe16f0e201ed005ef9f80e2cf798c374eed54e languageName: node linkType: hard @@ -12141,33 +12261,31 @@ fsevents@^2.3.2: languageName: node linkType: hard -"jest-snapshot@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-snapshot@npm:27.5.1" +"jest-snapshot@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-snapshot@npm:29.7.0" dependencies: - "@babel/core": ^7.7.2 + "@babel/core": ^7.11.6 "@babel/generator": ^7.7.2 + "@babel/plugin-syntax-jsx": ^7.7.2 "@babel/plugin-syntax-typescript": ^7.7.2 - "@babel/traverse": ^7.7.2 - "@babel/types": ^7.0.0 - "@jest/transform": ^27.5.1 - "@jest/types": ^27.5.1 - "@types/babel__traverse": ^7.0.4 - "@types/prettier": ^2.1.5 + "@babel/types": ^7.3.3 + "@jest/expect-utils": ^29.7.0 + "@jest/transform": ^29.7.0 + "@jest/types": ^29.6.3 babel-preset-current-node-syntax: ^1.0.0 chalk: ^4.0.0 - expect: ^27.5.1 + expect: ^29.7.0 graceful-fs: ^4.2.9 - jest-diff: ^27.5.1 - jest-get-type: ^27.5.1 - jest-haste-map: ^27.5.1 - jest-matcher-utils: ^27.5.1 - jest-message-util: ^27.5.1 - jest-util: ^27.5.1 + jest-diff: ^29.7.0 + jest-get-type: ^29.6.3 + jest-matcher-utils: ^29.7.0 + jest-message-util: ^29.7.0 + jest-util: ^29.7.0 natural-compare: ^1.4.0 - pretty-format: ^27.5.1 - semver: ^7.3.2 - checksum: a5cfadf0d21cd76063925d1434bc076443ed6d87847d0e248f0b245f11db3d98ff13e45cc03b15404027dabecd712d925f47b6eae4f64986f688640a7d362514 + pretty-format: ^29.7.0 + semver: ^7.5.3 + checksum: 86821c3ad0b6899521ce75ee1ae7b01b17e6dfeff9166f2cf17f012e0c5d8c798f30f9e4f8f7f5bed01ea7b55a6bc159f5eda778311162cbfa48785447c237ad languageName: node linkType: hard @@ -12191,7 +12309,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"jest-util@npm:^27.0.0, jest-util@npm:^27.5.1": +"jest-util@npm:^27.5.1": version: 27.5.1 resolution: "jest-util@npm:27.5.1" dependencies: @@ -12205,6 +12323,20 @@ fsevents@^2.3.2: languageName: node linkType: hard +"jest-util@npm:^29.0.0, jest-util@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-util@npm:29.7.0" + dependencies: + "@jest/types": ^29.6.3 + "@types/node": "*" + chalk: ^4.0.0 + ci-info: ^3.2.0 + graceful-fs: ^4.2.9 + picomatch: ^2.2.3 + checksum: 042ab4980f4ccd4d50226e01e5c7376a8556b472442ca6091a8f102488c0f22e6e8b89ea874111d2328a2080083bf3225c86f3788c52af0bd0345a00eb57a3ca + languageName: node + linkType: hard + "jest-validate@npm:^24.9.0": version: 24.9.0 resolution: "jest-validate@npm:24.9.0" @@ -12219,32 +12351,33 @@ fsevents@^2.3.2: languageName: node linkType: hard -"jest-validate@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-validate@npm:27.5.1" +"jest-validate@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-validate@npm:29.7.0" dependencies: - "@jest/types": ^27.5.1 + "@jest/types": ^29.6.3 camelcase: ^6.2.0 chalk: ^4.0.0 - jest-get-type: ^27.5.1 + jest-get-type: ^29.6.3 leven: ^3.1.0 - pretty-format: ^27.5.1 - checksum: 82e870f8ee7e4fb949652711b1567f05ae31c54be346b0899e8353e5c20fad7692b511905b37966945e90af8dc0383eb41a74f3ffefb16140ea4f9164d841412 + pretty-format: ^29.7.0 + checksum: 191fcdc980f8a0de4dbdd879fa276435d00eb157a48683af7b3b1b98b0f7d9de7ffe12689b617779097ff1ed77601b9f7126b0871bba4f776e222c40f62e9dae languageName: node linkType: hard -"jest-watcher@npm:^27.5.1": - version: 27.5.1 - resolution: "jest-watcher@npm:27.5.1" +"jest-watcher@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-watcher@npm:29.7.0" dependencies: - "@jest/test-result": ^27.5.1 - "@jest/types": ^27.5.1 + "@jest/test-result": ^29.7.0 + "@jest/types": ^29.6.3 "@types/node": "*" ansi-escapes: ^4.2.1 chalk: ^4.0.0 - jest-util: ^27.5.1 + emittery: ^0.13.1 + jest-util: ^29.7.0 string-length: ^4.0.1 - checksum: 191c4e9c278c0902ade1a8a80883ac244963ba3e6e78607a3d5f729ccca9c6e71fb3b316f87883658132641c5d818aa84202585c76752e03c539e6cbecb820bd + checksum: 67e6e7fe695416deff96b93a14a561a6db69389a0667e9489f24485bb85e5b54e12f3b2ba511ec0b777eca1e727235b073e3ebcdd473d68888650489f88df92f languageName: node linkType: hard @@ -12269,13 +12402,26 @@ fsevents@^2.3.2: languageName: node linkType: hard -"jest@npm:^27.0.6": - version: 27.5.1 - resolution: "jest@npm:27.5.1" +"jest-worker@npm:^29.7.0": + version: 29.7.0 + resolution: "jest-worker@npm:29.7.0" + dependencies: + "@types/node": "*" + jest-util: ^29.7.0 + merge-stream: ^2.0.0 + supports-color: ^8.0.0 + checksum: 30fff60af49675273644d408b650fc2eb4b5dcafc5a0a455f238322a8f9d8a98d847baca9d51ff197b6747f54c7901daa2287799230b856a0f48287d131f8c13 + languageName: node + linkType: hard + +"jest@npm:^29.7.0": + version: 29.7.0 + resolution: "jest@npm:29.7.0" dependencies: - "@jest/core": ^27.5.1 + "@jest/core": ^29.7.0 + "@jest/types": ^29.6.3 import-local: ^3.0.2 - jest-cli: ^27.5.1 + jest-cli: ^29.7.0 peerDependencies: node-notifier: ^8.0.1 || ^9.0.0 || ^10.0.0 peerDependenciesMeta: @@ -12283,7 +12429,7 @@ fsevents@^2.3.2: optional: true bin: jest: bin/jest.js - checksum: 96f1d69042b3c6dfc695f2a4e4b0db38af6fb78582ad1a02beaa57cfcd77cbd31567d7d865c1c85709b7c3e176eefa3b2035ffecd646005f15d8ef528eccf205 + checksum: 17ca8d67504a7dbb1998cf3c3077ec9031ba3eb512da8d71cb91bcabb2b8995c4e4b292b740cb9bf1cbff5ce3e110b3f7c777b0cefb6f41ab05445f248d0ee0b languageName: node linkType: hard @@ -12335,13 +12481,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"jsbn@npm:~0.1.0": - version: 0.1.1 - resolution: "jsbn@npm:0.1.1" - checksum: e5ff29c1b8d965017ef3f9c219dacd6e40ad355c664e277d31246c90545a02e6047018c16c60a00f36d561b3647215c41894f5d869ada6908a2e0ce4200c88f2 - languageName: node - linkType: hard - "jsc-android@npm:^245459.0.0": version: 245459.0.0 resolution: "jsc-android@npm:245459.0.0" @@ -12356,82 +12495,42 @@ fsevents@^2.3.2: languageName: node linkType: hard -"jsdom@npm:^16.6.0": - version: 16.7.0 - resolution: "jsdom@npm:16.7.0" +"jsdom@npm:^20.0.0": + version: 20.0.3 + resolution: "jsdom@npm:20.0.3" dependencies: - abab: ^2.0.5 - acorn: ^8.2.4 - acorn-globals: ^6.0.0 - cssom: ^0.4.4 + abab: ^2.0.6 + acorn: ^8.8.1 + acorn-globals: ^7.0.0 + cssom: ^0.5.0 cssstyle: ^2.3.0 - data-urls: ^2.0.0 - decimal.js: ^10.2.1 - domexception: ^2.0.1 + data-urls: ^3.0.2 + decimal.js: ^10.4.2 + domexception: ^4.0.0 escodegen: ^2.0.0 - form-data: ^3.0.0 - html-encoding-sniffer: ^2.0.1 - http-proxy-agent: ^4.0.1 - https-proxy-agent: ^5.0.0 + form-data: ^4.0.0 + html-encoding-sniffer: ^3.0.0 + http-proxy-agent: ^5.0.0 + https-proxy-agent: ^5.0.1 is-potential-custom-element-name: ^1.0.1 - nwsapi: ^2.2.0 - parse5: 6.0.1 - saxes: ^5.0.1 + nwsapi: ^2.2.2 + parse5: ^7.1.1 + saxes: ^6.0.0 symbol-tree: ^3.2.4 - tough-cookie: ^4.0.0 - w3c-hr-time: ^1.0.2 - w3c-xmlserializer: ^2.0.0 - webidl-conversions: ^6.1.0 - whatwg-encoding: ^1.0.5 - whatwg-mimetype: ^2.3.0 - whatwg-url: ^8.5.0 - ws: ^7.4.6 - xml-name-validator: ^3.0.0 - peerDependencies: - canvas: ^2.5.0 - peerDependenciesMeta: - canvas: - optional: true - checksum: 454b83371857000763ed31130a049acd1b113e3b927e6dcd75c67ddc30cdd242d7ebcac5c2294b7a1a6428155cb1398709c573b3c6d809218692ea68edd93370 - languageName: node - linkType: hard - -"jsdom@npm:~15.2.1": - version: 15.2.1 - resolution: "jsdom@npm:15.2.1" - dependencies: - abab: ^2.0.0 - acorn: ^7.1.0 - acorn-globals: ^4.3.2 - array-equal: ^1.0.0 - cssom: ^0.4.1 - cssstyle: ^2.0.0 - data-urls: ^1.1.0 - domexception: ^1.0.1 - escodegen: ^1.11.1 - html-encoding-sniffer: ^1.0.2 - nwsapi: ^2.2.0 - parse5: 5.1.0 - pn: ^1.1.0 - request: ^2.88.0 - request-promise-native: ^1.0.7 - saxes: ^3.1.9 - symbol-tree: ^3.2.2 - tough-cookie: ^3.0.1 - w3c-hr-time: ^1.0.1 - w3c-xmlserializer: ^1.1.2 - webidl-conversions: ^4.0.2 - whatwg-encoding: ^1.0.5 - whatwg-mimetype: ^2.3.0 - whatwg-url: ^7.0.0 - ws: ^7.0.0 - xml-name-validator: ^3.0.0 + tough-cookie: ^4.1.2 + w3c-xmlserializer: ^4.0.0 + webidl-conversions: ^7.0.0 + whatwg-encoding: ^2.0.0 + whatwg-mimetype: ^3.0.0 + whatwg-url: ^11.0.0 + ws: ^8.11.0 + xml-name-validator: ^4.0.0 peerDependencies: canvas: ^2.5.0 peerDependenciesMeta: canvas: optional: true - checksum: eff437b977330b1e63cd3ee2c2fe7c799c876799cae35525e1e6864d939dd41631ebd65f847adaeb83c2160c828d027d0f1d0dbe88366d1da22c875a5165a78c + checksum: 6e2ae21db397133a061b270c26d2dbc0b9051733ea3b896a7ece78d79f475ff0974f766a413c1198a79c793159119169f2335ddb23150348fbfdcfa6f3105536 languageName: node linkType: hard @@ -12444,6 +12543,15 @@ fsevents@^2.3.2: languageName: node linkType: hard +"jsesc@npm:^3.0.2": + version: 3.0.2 + resolution: "jsesc@npm:3.0.2" + bin: + jsesc: bin/jsesc + checksum: a36d3ca40574a974d9c2063bf68c2b6141c20da8f2a36bd3279fc802563f35f0527a6c828801295bdfb2803952cf2cf387786c2c90ed564f88d5782475abfe3c + languageName: node + linkType: hard + "jsesc@npm:~0.5.0": version: 0.5.0 resolution: "jsesc@npm:0.5.0" @@ -12488,13 +12596,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"json-schema@npm:0.4.0": - version: 0.4.0 - resolution: "json-schema@npm:0.4.0" - checksum: 66389434c3469e698da0df2e7ac5a3281bcff75e797a5c127db7c5b56270e01ae13d9afa3c03344f76e32e81678337a8c912bdbb75101c62e487dc3778461d72 - languageName: node - linkType: hard - "json-stable-stringify-without-jsonify@npm:^1.0.1": version: 1.0.1 resolution: "json-stable-stringify-without-jsonify@npm:1.0.1" @@ -12511,22 +12612,13 @@ fsevents@^2.3.2: languageName: node linkType: hard -"json-stringify-safe@npm:^5.0.1, json-stringify-safe@npm:~5.0.1": +"json-stringify-safe@npm:^5.0.1": version: 5.0.1 resolution: "json-stringify-safe@npm:5.0.1" checksum: 48ec0adad5280b8a96bb93f4563aa1667fd7a36334f79149abd42446d0989f2ddc58274b479f4819f1f00617957e6344c886c55d05a4e15ebb4ab931e4a6a8ee languageName: node linkType: hard -"json5@npm:2.x, json5@npm:^2.2.2": - version: 2.2.3 - resolution: "json5@npm:2.2.3" - bin: - json5: lib/cli.js - checksum: 2a7436a93393830bce797d4626275152e37e877b265e94ca69c99e3d20c2b9dab021279146a39cdb700e71b2dd32a4cebd1514cd57cee102b1af906ce5040349 - languageName: node - linkType: hard - "json5@npm:^1.0.2": version: 1.0.2 resolution: "json5@npm:1.0.2" @@ -12538,6 +12630,15 @@ fsevents@^2.3.2: languageName: node linkType: hard +"json5@npm:^2.2.2, json5@npm:^2.2.3": + version: 2.2.3 + resolution: "json5@npm:2.2.3" + bin: + json5: lib/cli.js + checksum: 2a7436a93393830bce797d4626275152e37e877b265e94ca69c99e3d20c2b9dab021279146a39cdb700e71b2dd32a4cebd1514cd57cee102b1af906ce5040349 + languageName: node + linkType: hard + "jsonc-parser@npm:3.2.0": version: 3.2.0 resolution: "jsonc-parser@npm:3.2.0" @@ -12596,18 +12697,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"jsprim@npm:^1.2.2": - version: 1.4.2 - resolution: "jsprim@npm:1.4.2" - dependencies: - assert-plus: 1.0.0 - extsprintf: 1.3.0 - json-schema: 0.4.0 - verror: 1.10.0 - checksum: 2ad1b9fdcccae8b3d580fa6ced25de930eaa1ad154db21bbf8478a4d30bbbec7925b5f5ff29b933fba9412b16a17bd484a8da4fdb3663b5e27af95dd693bab2a - languageName: node - linkType: hard - "jsx-ast-utils@npm:^2.4.1 || ^3.0.0, jsx-ast-utils@npm:^3.3.5": version: 3.3.5 resolution: "jsx-ast-utils@npm:3.3.5" @@ -13064,7 +13153,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"lodash.memoize@npm:4.x": +"lodash.memoize@npm:^4.1.2": version: 4.1.2 resolution: "lodash.memoize@npm:4.1.2" checksum: 9ff3942feeccffa4f1fafa88d32f0d24fdc62fd15ded5a74a5f950ff5f0c6f61916157246744c620173dddf38d37095a92327d5fd3861e2063e736a5c207d089 @@ -13092,7 +13181,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.21, lodash@npm:^4.17.4, lodash@npm:^4.3.0, lodash@npm:^4.7.0, lodash@npm:~4.17.15": +"lodash@npm:^4.17.14, lodash@npm:^4.17.15, lodash@npm:^4.17.19, lodash@npm:^4.17.21, lodash@npm:^4.17.4, lodash@npm:^4.3.0": version: 4.17.21 resolution: "lodash@npm:4.17.21" checksum: eb835a2e51d381e561e508ce932ea50a8e5a68f4ebdd771ea240d3048244a8d13658acbd502cd4829768c56f2e16bdd4340b9ea141297d472517b83868e677f7 @@ -13210,12 +13299,11 @@ fsevents@^2.3.2: "@eslint/compat": ^1.2.2 "@eslint/eslintrc": ^3.1.0 "@eslint/js": ^9.14.0 - "@ikscodes/browser-env": ~0.3.1 "@istanbuljs/nyc-config-typescript": ~0.1.3 "@types/fs-extra": ^9.0.13 "@types/inquirer": ^8.1.1 "@types/is-ci": ^3.0.0 - "@types/jest": ^27.0.0 + "@types/jest": ^29.5.11 "@types/jsdom": ~12.2.4 "@types/lodash": ^4.14.172 "@types/react": ^18.0.26 @@ -13246,7 +13334,8 @@ fsevents@^2.3.2: husky: ^7.0.1 inquirer: ^8.1.2 is-ci: ^3.0.0 - jest: ^27.0.6 + jest: ^29.7.0 + jest-environment-jsdom: ^29.7.0 lerna: 8.0.2 lint-staged: ^10.0.7 lodash: ^4.17.21 @@ -13262,7 +13351,7 @@ fsevents@^2.3.2: regenerator-runtime: 0.13.9 replace-in-file: ^6.1.0 rimraf: ~3.0.2 - ts-jest: ^27.0.4 + ts-jest: ^29.1.4 ts-node: ^10.2.0 tsc-watch: ^4.2.9 tslib: ^2.3.1 @@ -13324,7 +13413,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"make-error@npm:1.x, make-error@npm:^1, make-error@npm:^1.1.1": +"make-error@npm:^1, make-error@npm:^1.1.1, make-error@npm:^1.3.6": version: 1.3.6 resolution: "make-error@npm:1.3.6" checksum: b86e5e0e25f7f777b77fabd8e2cbf15737972869d852a22b7e73c17623928fccb826d8e46b9951501d3f20e51ad74ba8c59ed584f610526a48f8ccf88aaec402 @@ -14051,7 +14140,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"mime-types@npm:^2.1.12, mime-types@npm:~2.1.19, mime-types@npm:~2.1.34": +"mime-types@npm:^2.1.12, mime-types@npm:~2.1.34": version: 2.1.35 resolution: "mime-types@npm:2.1.35" dependencies: @@ -14642,6 +14731,13 @@ fsevents@^2.3.2: languageName: node linkType: hard +"node-releases@npm:^2.0.18": + version: 2.0.18 + resolution: "node-releases@npm:2.0.18" + checksum: ef55a3d853e1269a6d6279b7692cd6ff3e40bc74947945101138745bfdc9a5edabfe72cb19a31a8e45752e1910c4c65c77d931866af6357f242b172b7283f5b3 + languageName: node + linkType: hard + "node-releases@npm:^2.0.8": version: 2.0.10 resolution: "node-releases@npm:2.0.10" @@ -14969,10 +15065,10 @@ fsevents@^2.3.2: languageName: node linkType: hard -"nwsapi@npm:^2.2.0": - version: 2.2.2 - resolution: "nwsapi@npm:2.2.2" - checksum: 43769106292bc95f776756ca2f3513dab7b4d506a97c67baec32406447841a35f65f29c1f95ab5d42785210fd41668beed33ca16fa058780be43b101ad73e205 +"nwsapi@npm:^2.2.2": + version: 2.2.13 + resolution: "nwsapi@npm:2.2.13" + checksum: d34fb7838517c3c7e8cc824e443275b08b57f6a025a860693d18c56ddcfd176e32df9bf0ae7f5a95c7a32981501caa1f9fda31b59f28aa72a4b9d01f573a8e6b languageName: node linkType: hard @@ -15095,13 +15191,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"oauth-sign@npm:~0.9.0": - version: 0.9.0 - resolution: "oauth-sign@npm:0.9.0" - checksum: 8f5497a127967866a3c67094c21efd295e46013a94e6e828573c62220e9af568cc1d2d04b16865ba583e430510fa168baf821ea78f355146d8ed7e350fc44c64 - languageName: node - linkType: hard - "ob1@npm:0.58.0": version: 0.58.0 resolution: "ob1@npm:0.58.0" @@ -15727,20 +15816,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"parse5@npm:5.1.0": - version: 5.1.0 - resolution: "parse5@npm:5.1.0" - checksum: 13c44c6d47035a3cc75303655ae5630dc264f9b9ab8344feb3f79ca195d8b57a2a246af902abef1d780ad1eee92eb9b88cd03098a7ee7dd111f032152ebaf0a6 - languageName: node - linkType: hard - -"parse5@npm:6.0.1": - version: 6.0.1 - resolution: "parse5@npm:6.0.1" - checksum: 7d569a176c5460897f7c8f3377eff640d54132b9be51ae8a8fa4979af940830b2b0c296ce75e5bd8f4041520aadde13170dbdec44889975f906098ea0002f4bd - languageName: node - linkType: hard - "parse5@npm:^4.0.0": version: 4.0.0 resolution: "parse5@npm:4.0.0" @@ -15748,6 +15823,15 @@ fsevents@^2.3.2: languageName: node linkType: hard +"parse5@npm:^7.0.0, parse5@npm:^7.1.1": + version: 7.2.1 + resolution: "parse5@npm:7.2.1" + dependencies: + entities: ^4.5.0 + checksum: 11253cf8aa2e7fc41c004c64cba6f2c255f809663365db65bd7ad0e8cf7b89e436a563c20059346371cc543a6c1b567032088883ca6a2cbc88276c666b68236d + languageName: node + linkType: hard + "parseurl@npm:~1.3.3": version: 1.3.3 resolution: "parseurl@npm:1.3.3" @@ -15852,13 +15936,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"performance-now@npm:^2.1.0": - version: 2.1.0 - resolution: "performance-now@npm:2.1.0" - checksum: 534e641aa8f7cba160f0afec0599b6cecefbb516a2e837b512be0adbe6c1da5550e89c78059c7fabc5c9ffdf6627edabe23eb7c518c4500067a898fa65c2b550 - languageName: node - linkType: hard - "picocolors@npm:^1.0.0": version: 1.0.0 resolution: "picocolors@npm:1.0.0" @@ -15866,6 +15943,13 @@ fsevents@^2.3.2: languageName: node linkType: hard +"picocolors@npm:^1.1.0": + version: 1.1.1 + resolution: "picocolors@npm:1.1.1" + checksum: e1cf46bf84886c79055fdfa9dcb3e4711ad259949e3565154b004b260cd356c5d54b31a1437ce9782624bf766272fe6b0154f5f0c744fb7af5d454d2b60db045 + languageName: node + linkType: hard + "picomatch@npm:^2.0.4, picomatch@npm:^2.2.3, picomatch@npm:^2.3.1": version: 2.3.1 resolution: "picomatch@npm:2.3.1" @@ -15977,13 +16061,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"pn@npm:^1.1.0": - version: 1.1.0 - resolution: "pn@npm:1.1.0" - checksum: e4654186dc92a187c8c7fe4ccda902f4d39dd9c10f98d1c5a08ce5fad5507ef1e33ddb091240c3950bee81bd201b4c55098604c433a33b5e8bdd97f38b732fa0 - languageName: node - linkType: hard - "posix-character-classes@npm:^0.1.0": version: 0.1.1 resolution: "posix-character-classes@npm:0.1.1" @@ -16068,18 +16145,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"pretty-format@npm:^27.0.0, pretty-format@npm:^27.5.1": - version: 27.5.1 - resolution: "pretty-format@npm:27.5.1" - dependencies: - ansi-regex: ^5.0.1 - ansi-styles: ^5.0.0 - react-is: ^17.0.1 - checksum: cf610cffcb793885d16f184a62162f2dd0df31642d9a18edf4ca298e909a8fe80bdbf556d5c9573992c102ce8bf948691da91bf9739bee0ffb6e79c8a8a6e088 - languageName: node - linkType: hard - -"pretty-format@npm:^29.7.0": +"pretty-format@npm:^29.0.0, pretty-format@npm:^29.7.0": version: 29.7.0 resolution: "pretty-format@npm:29.7.0" dependencies: @@ -16215,7 +16281,7 @@ fsevents@^2.3.2: languageName: node linkType: hard -"psl@npm:^1.1.28, psl@npm:^1.1.33": +"psl@npm:^1.1.33": version: 1.9.0 resolution: "psl@npm:1.9.0" checksum: 20c4277f640c93d393130673f392618e9a8044c6c7bf61c53917a0fddb4952790f5f362c6c730a9c32b124813e173733f9895add8d26f566ed0ea0654b2e711d @@ -16246,6 +16312,13 @@ fsevents@^2.3.2: languageName: node linkType: hard +"pure-rand@npm:^6.0.0": + version: 6.1.0 + resolution: "pure-rand@npm:6.1.0" + checksum: 8d53bc02bed99eca0b65b505090152ee7e9bd67dd74f8ff32ba1c883b87234067c5bf68d2614759fb217d82594d7a92919e6df80f97885e7b12b42af4bd3316a + languageName: node + linkType: hard + "pvtsutils@npm:^1.3.2": version: 1.3.2 resolution: "pvtsutils@npm:1.3.2" @@ -16262,13 +16335,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"qs@npm:~6.5.2": - version: 6.5.3 - resolution: "qs@npm:6.5.3" - checksum: 6f20bf08cabd90c458e50855559539a28d00b2f2e7dddcb66082b16a43188418cb3cb77cbd09268bcef6022935650f0534357b8af9eeb29bf0f27ccb17655692 - languageName: node - linkType: hard - "query-string@npm:^5.0.1": version: 5.1.1 resolution: "query-string@npm:5.1.1" @@ -16355,13 +16421,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"react-is@npm:^17.0.1": - version: 17.0.2 - resolution: "react-is@npm:17.0.2" - checksum: 9d6d111d8990dc98bc5402c1266a808b0459b5d54830bbea24c12d908b536df7883f268a7868cfaedde3dd9d4e0d574db456f84d2e6df9c4526f99bb4b5344d8 - languageName: node - linkType: hard - "react-is@npm:^18.0.0": version: 18.2.0 resolution: "react-is@npm:18.2.0" @@ -16855,58 +16914,6 @@ fsevents@^2.3.2: languageName: node linkType: hard -"request-promise-core@npm:1.1.4": - version: 1.1.4 - resolution: "request-promise-core@npm:1.1.4" - dependencies: - lodash: ^4.17.19 - peerDependencies: - request: ^2.34 - checksum: c798bafd552961e36fbf5023b1d081e81c3995ab390f1bc8ef38a711ba3fe4312eb94dbd61887073d7356c3499b9380947d7f62faa805797c0dc50f039425699 - languageName: node - linkType: hard - -"request-promise-native@npm:^1.0.7": - version: 1.0.9 - resolution: "request-promise-native@npm:1.0.9" - dependencies: - request-promise-core: 1.1.4 - stealthy-require: ^1.1.1 - tough-cookie: ^2.3.3 - peerDependencies: - request: ^2.34 - checksum: 3e2c694eefac88cb20beef8911ad57a275ab3ccbae0c4ca6c679fffb09d5fd502458aab08791f0814ca914b157adab2d4e472597c97a73be702918e41725ed69 - languageName: node - linkType: hard - -"request@npm:^2.88.0": - version: 2.88.2 - resolution: "request@npm:2.88.2" - dependencies: - aws-sign2: ~0.7.0 - aws4: ^1.8.0 - caseless: ~0.12.0 - combined-stream: ~1.0.6 - extend: ~3.0.2 - forever-agent: ~0.6.1 - form-data: ~2.3.2 - har-validator: ~5.1.3 - http-signature: ~1.2.0 - is-typedarray: ~1.0.0 - isstream: ~0.1.2 - json-stringify-safe: ~5.0.1 - mime-types: ~2.1.19 - oauth-sign: ~0.9.0 - performance-now: ^2.1.0 - qs: ~6.5.2 - safe-buffer: ^5.1.2 - tough-cookie: ~2.5.0 - tunnel-agent: ^0.6.0 - uuid: ^3.3.2 - checksum: 4e112c087f6eabe7327869da2417e9d28fcd0910419edd2eb17b6acfc4bfa1dad61954525949c228705805882d8a98a86a0ea12d7f739c01ee92af7062996983 - languageName: node - linkType: hard - "require-directory@npm:^2.1.1": version: 2.1.1 resolution: "require-directory@npm:2.1.1" @@ -16990,10 +16997,10 @@ fsevents@^2.3.2: languageName: node linkType: hard -"resolve.exports@npm:^1.1.0": - version: 1.1.1 - resolution: "resolve.exports@npm:1.1.1" - checksum: 485aa10082eb388a569d696e17ad7b16f4186efc97dd34eadd029d95b811f21ffee13b1b733198bb4584dbb3cb296aa6f141835221fb7613b9606b84f1386655 +"resolve.exports@npm:^2.0.0": + version: 2.0.2 + resolution: "resolve.exports@npm:2.0.2" + checksum: 1c7778ca1b86a94f8ab4055d196c7d87d1874b96df4d7c3e67bbf793140f0717fd506dcafd62785b079cd6086b9264424ad634fb904409764c3509c3df1653f2 languageName: node linkType: hard @@ -17328,7 +17335,7 @@ resolve@~1.7.1: languageName: node linkType: hard -"safer-buffer@npm:>= 2.1.2 < 3, safer-buffer@npm:>= 2.1.2 < 3.0.0, safer-buffer@npm:^2.0.2, safer-buffer@npm:^2.1.0, safer-buffer@npm:~2.1.0": +"safer-buffer@npm:>= 2.1.2 < 3, safer-buffer@npm:>= 2.1.2 < 3.0.0": version: 2.1.2 resolution: "safer-buffer@npm:2.1.2" checksum: cab8f25ae6f1434abee8d80023d7e72b598cf1327164ddab31003c51215526801e40b66c5e65d658a0af1e9d6478cadcb4c745f4bd6751f97d8644786c0978b0 @@ -17361,21 +17368,12 @@ resolve@~1.7.1: languageName: node linkType: hard -"saxes@npm:^3.1.9": - version: 3.1.11 - resolution: "saxes@npm:3.1.11" - dependencies: - xmlchars: ^2.1.1 - checksum: 3b69918c013fffae51c561f629a0f620c02dba70f762dab38f3cd92676dfe5edf1f0a523ca567882838f1a80e26e4671a8c2c689afa05c68f45a78261445aba0 - languageName: node - linkType: hard - -"saxes@npm:^5.0.1": - version: 5.0.1 - resolution: "saxes@npm:5.0.1" +"saxes@npm:^6.0.0": + version: 6.0.0 + resolution: "saxes@npm:6.0.0" dependencies: xmlchars: ^2.2.0 - checksum: 5636b55cf15f7cf0baa73f2797bf992bdcf75d1b39d82c0aa4608555c774368f6ac321cb641fd5f3d3ceb87805122cd47540da6a7b5960fe0dbdb8f8c263f000 + checksum: d3fa3e2aaf6c65ed52ee993aff1891fc47d5e47d515164b5449cbf5da2cbdc396137e55590472e64c5c436c14ae64a8a03c29b9e7389fc6f14035cf4e982ef3b languageName: node linkType: hard @@ -17441,7 +17439,7 @@ resolve@~1.7.1: languageName: node linkType: hard -"semver@npm:7.5.3, semver@npm:7.x, semver@npm:^7.0.0, semver@npm:^7.3.2, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.8": +"semver@npm:7.5.3, semver@npm:^7.0.0, semver@npm:^7.3.4, semver@npm:^7.3.5, semver@npm:^7.3.8": version: 7.5.3 resolution: "semver@npm:7.5.3" dependencies: @@ -17481,7 +17479,7 @@ resolve@~1.7.1: languageName: node linkType: hard -"semver@npm:^7.6.0, semver@npm:^7.6.3": +"semver@npm:^7.5.4, semver@npm:^7.6.0, semver@npm:^7.6.3": version: 7.6.3 resolution: "semver@npm:7.6.3" bin: @@ -17934,7 +17932,17 @@ resolve@~1.7.1: languageName: node linkType: hard -"source-map-support@npm:^0.5.16, source-map-support@npm:^0.5.17, source-map-support@npm:^0.5.6": +"source-map-support@npm:0.5.13": + version: 0.5.13 + resolution: "source-map-support@npm:0.5.13" + dependencies: + buffer-from: ^1.0.0 + source-map: ^0.6.0 + checksum: 933550047b6c1a2328599a21d8b7666507427c0f5ef5eaadd56b5da0fd9505e239053c66fe181bf1df469a3b7af9d775778eee283cbb7ae16b902ddc09e93a97 + languageName: node + linkType: hard + +"source-map-support@npm:^0.5.16, source-map-support@npm:^0.5.17": version: 0.5.21 resolution: "source-map-support@npm:0.5.21" dependencies: @@ -18063,27 +18071,6 @@ resolve@~1.7.1: languageName: node linkType: hard -"sshpk@npm:^1.7.0": - version: 1.17.0 - resolution: "sshpk@npm:1.17.0" - dependencies: - asn1: ~0.2.3 - assert-plus: ^1.0.0 - bcrypt-pbkdf: ^1.0.0 - dashdash: ^1.12.0 - ecc-jsbn: ~0.1.1 - getpass: ^0.1.1 - jsbn: ~0.1.0 - safer-buffer: ^2.0.2 - tweetnacl: ~0.14.0 - bin: - sshpk-conv: bin/sshpk-conv - sshpk-sign: bin/sshpk-sign - sshpk-verify: bin/sshpk-verify - checksum: ba109f65c8e6c35133b8e6ed5576abeff8aa8d614824b7275ec3ca308f081fef483607c28d97780c1e235818b0f93ed8c8b56d0a5968d5a23fd6af57718c7597 - languageName: node - linkType: hard - "ssri@npm:^10.0.0, ssri@npm:^10.0.1": version: 10.0.5 resolution: "ssri@npm:10.0.5" @@ -18160,13 +18147,6 @@ resolve@~1.7.1: languageName: node linkType: hard -"stealthy-require@npm:^1.1.1": - version: 1.1.1 - resolution: "stealthy-require@npm:1.1.1" - checksum: 6805b857a9f3a6a1079fc6652278038b81011f2a5b22cbd559f71a6c02087e6f1df941eb10163e3fdc5391ab5807aa46758d4258547c1f5ede31e6d9bfda8dd3 - languageName: node - linkType: hard - "stream-buffers@npm:2.2.x": version: 2.2.0 resolution: "stream-buffers@npm:2.2.0" @@ -18590,7 +18570,7 @@ resolve@~1.7.1: languageName: node linkType: hard -"symbol-tree@npm:^3.2.2, symbol-tree@npm:^3.2.4": +"symbol-tree@npm:^3.2.4": version: 3.2.4 resolution: "symbol-tree@npm:3.2.4" checksum: 6e8fc7e1486b8b54bea91199d9535bb72f10842e40c79e882fc94fb7b14b89866adf2fd79efa5ebb5b658bc07fb459ccce5ac0e99ef3d72f474e74aaf284029d @@ -18684,7 +18664,7 @@ resolve@~1.7.1: languageName: node linkType: hard -"terminal-link@npm:^2.0.0, terminal-link@npm:^2.1.1": +"terminal-link@npm:^2.1.1": version: 2.1.1 resolution: "terminal-link@npm:2.1.1" dependencies: @@ -18752,13 +18732,6 @@ resolve@~1.7.1: languageName: node linkType: hard -"throat@npm:^6.0.1": - version: 6.0.2 - resolution: "throat@npm:6.0.2" - checksum: 463093768d4884772020bb18b0f33d3fec8a2b4173f7da3958dfbe88ff0f1e686ffadf0f87333bf6f6db7306b1450efc7855df69c78bf0bfa61f6d84a3361fe8 - languageName: node - linkType: hard - "through2@npm:^2.0.0, through2@npm:^2.0.1": version: 2.0.5 resolution: "through2@npm:2.0.5" @@ -18876,54 +18849,33 @@ resolve@~1.7.1: languageName: node linkType: hard -"tough-cookie@npm:^2.3.3, tough-cookie@npm:~2.5.0": - version: 2.5.0 - resolution: "tough-cookie@npm:2.5.0" - dependencies: - psl: ^1.1.28 - punycode: ^2.1.1 - checksum: 16a8cd090224dd176eee23837cbe7573ca0fa297d7e468ab5e1c02d49a4e9a97bb05fef11320605eac516f91d54c57838a25864e8680e27b069a5231d8264977 - languageName: node - linkType: hard - -"tough-cookie@npm:^3.0.1": - version: 3.0.1 - resolution: "tough-cookie@npm:3.0.1" - dependencies: - ip-regex: ^2.1.0 - psl: ^1.1.28 - punycode: ^2.1.1 - checksum: 796f6239bce5674a1267b19f41972a2602a2a23715817237b5922b0dc2343512512eea7d41d29210a4ec545f8ef32173bbbf01277dd8ec3ae3841b19cbe69f67 - languageName: node - linkType: hard - -"tough-cookie@npm:^4.0.0": - version: 4.1.2 - resolution: "tough-cookie@npm:4.1.2" +"tough-cookie@npm:^4.1.2": + version: 4.1.4 + resolution: "tough-cookie@npm:4.1.4" dependencies: psl: ^1.1.33 punycode: ^2.1.1 universalify: ^0.2.0 url-parse: ^1.5.3 - checksum: a7359e9a3e875121a84d6ba40cc184dec5784af84f67f3a56d1d2ae39b87c0e004e6ba7c7331f9622a7d2c88609032473488b28fe9f59a1fec115674589de39a + checksum: 5815059f014c31179a303c673f753f7899a6fce94ac93712c88ea5f3c26e0c042b5f0c7a599a00f8e0feeca4615dba75c3dffc54f3c1a489978aa8205e09307c languageName: node linkType: hard -"tr46@npm:^1.0.1": - version: 1.0.1 - resolution: "tr46@npm:1.0.1" +"tr46@npm:^2.0.2": + version: 2.1.0 + resolution: "tr46@npm:2.1.0" dependencies: - punycode: ^2.1.0 - checksum: 96d4ed46bc161db75dbf9247a236ea0bfcaf5758baae6749e92afab0bc5a09cb59af21788ede7e55080f2bf02dce3e4a8f2a484cc45164e29f4b5e68f7cbcc1a + punycode: ^2.1.1 + checksum: ffe6049b9dca3ae329b059aada7f515b0f0064c611b39b51ff6b53897e954650f6f63d9319c6c008d36ead477c7b55e5f64c9dc60588ddc91ff720d64eb710b3 languageName: node linkType: hard -"tr46@npm:^2.0.2, tr46@npm:^2.1.0": - version: 2.1.0 - resolution: "tr46@npm:2.1.0" +"tr46@npm:^3.0.0": + version: 3.0.0 + resolution: "tr46@npm:3.0.0" dependencies: punycode: ^2.1.1 - checksum: ffe6049b9dca3ae329b059aada7f515b0f0064c611b39b51ff6b53897e954650f6f63d9319c6c008d36ead477c7b55e5f64c9dc60588ddc91ff720d64eb710b3 + checksum: 44c3cc6767fb800490e6e9fd64fd49041aa4e49e1f6a012b34a75de739cc9ed3a6405296072c1df8b6389ae139c5e7c6496f659cfe13a04a4bff3a1422981270 languageName: node linkType: hard @@ -18950,28 +18902,32 @@ resolve@~1.7.1: languageName: node linkType: hard -"ts-jest@npm:^27.0.4": - version: 27.1.5 - resolution: "ts-jest@npm:27.1.5" +"ts-jest@npm:^29.1.4": + version: 29.2.5 + resolution: "ts-jest@npm:29.2.5" dependencies: - bs-logger: 0.x - fast-json-stable-stringify: 2.x - jest-util: ^27.0.0 - json5: 2.x - lodash.memoize: 4.x - make-error: 1.x - semver: 7.x - yargs-parser: 20.x + bs-logger: ^0.2.6 + ejs: ^3.1.10 + fast-json-stable-stringify: ^2.1.0 + jest-util: ^29.0.0 + json5: ^2.2.3 + lodash.memoize: ^4.1.2 + make-error: ^1.3.6 + semver: ^7.6.3 + yargs-parser: ^21.1.1 peerDependencies: "@babel/core": ">=7.0.0-beta.0 <8" - "@types/jest": ^27.0.0 - babel-jest: ">=27.0.0 <28" - jest: ^27.0.0 - typescript: ">=3.8 <5.0" + "@jest/transform": ^29.0.0 + "@jest/types": ^29.0.0 + babel-jest: ^29.0.0 + jest: ^29.0.0 + typescript: ">=4.3 <6" peerDependenciesMeta: "@babel/core": optional: true - "@types/jest": + "@jest/transform": + optional: true + "@jest/types": optional: true babel-jest: optional: true @@ -18979,7 +18935,7 @@ resolve@~1.7.1: optional: true bin: ts-jest: cli.js - checksum: 3ef51c538b82f49b3f529331c1a017871a2f90e7a9a6e69333304755036d121818c6b120e2ce32dd161ff8bb2487efec0c790753ecd39b46a9ed1ce0d241464c + checksum: d60d1e1d80936f6002b1bb27f7e062408bc733141b9d666565503f023c340a3196d506c836a4316c5793af81a5f910ab49bb9c13f66e2dc66de4e0f03851dbca languageName: node linkType: hard @@ -19153,15 +19109,6 @@ resolve@~1.7.1: languageName: node linkType: hard -"tunnel-agent@npm:^0.6.0": - version: 0.6.0 - resolution: "tunnel-agent@npm:0.6.0" - dependencies: - safe-buffer: ^5.0.1 - checksum: 05f6510358f8afc62a057b8b692f05d70c1782b70db86d6a1e0d5e28a32389e52fa6e7707b6c5ecccacc031462e4bc35af85ecfe4bbc341767917b7cf6965711 - languageName: node - linkType: hard - "tweetnacl@npm:1.0.3, tweetnacl@npm:^1.0.3": version: 1.0.3 resolution: "tweetnacl@npm:1.0.3" @@ -19169,13 +19116,6 @@ resolve@~1.7.1: languageName: node linkType: hard -"tweetnacl@npm:^0.14.3, tweetnacl@npm:~0.14.0": - version: 0.14.5 - resolution: "tweetnacl@npm:0.14.5" - checksum: 6061daba1724f59473d99a7bb82e13f211cdf6e31315510ae9656fefd4779851cb927adad90f3b488c8ed77c106adc0421ea8055f6f976ff21b27c5c4e918487 - languageName: node - linkType: hard - "type-check@npm:^0.4.0, type-check@npm:~0.4.0": version: 0.4.0 resolution: "type-check@npm:0.4.0" @@ -19596,6 +19536,20 @@ resolve@~1.7.1: languageName: node linkType: hard +"update-browserslist-db@npm:^1.1.1": + version: 1.1.1 + resolution: "update-browserslist-db@npm:1.1.1" + dependencies: + escalade: ^3.2.0 + picocolors: ^1.1.0 + peerDependencies: + browserslist: ">= 4.21.0" + bin: + update-browserslist-db: cli.js + checksum: 2ea11bd2562122162c3e438d83a1f9125238c0844b6d16d366e3276d0c0acac6036822dc7df65fc5a89c699cdf9f174acf439c39bedf3f9a2f3983976e4b4c3e + languageName: node + linkType: hard + "uri-js@npm:^4.2.2": version: 4.4.1 resolution: "uri-js@npm:4.4.1" @@ -19760,14 +19714,14 @@ resolve@~1.7.1: languageName: node linkType: hard -"v8-to-istanbul@npm:^8.1.0": - version: 8.1.1 - resolution: "v8-to-istanbul@npm:8.1.1" +"v8-to-istanbul@npm:^9.0.1": + version: 9.3.0 + resolution: "v8-to-istanbul@npm:9.3.0" dependencies: + "@jridgewell/trace-mapping": ^0.3.12 "@types/istanbul-lib-coverage": ^2.0.1 - convert-source-map: ^1.6.0 - source-map: ^0.7.3 - checksum: 54ce92bec2727879626f623d02c8d193f0c7e919941fa373ec135189a8382265117f5316ea317a1e12a5f9c13d84d8449052a731fe3306fa4beaafbfa4cab229 + convert-source-map: ^2.0.0 + checksum: ded42cd535d92b7fd09a71c4c67fb067487ef5551cc227bfbf2a1f159a842e4e4acddaef20b955789b8d3b455b9779d036853f4a27ce15007f6364a4d30317ae languageName: node linkType: hard @@ -19806,17 +19760,6 @@ resolve@~1.7.1: languageName: node linkType: hard -"verror@npm:1.10.0": - version: 1.10.0 - resolution: "verror@npm:1.10.0" - dependencies: - assert-plus: ^1.0.0 - core-util-is: 1.0.2 - extsprintf: ^1.2.0 - checksum: c431df0bedf2088b227a4e051e0ff4ca54df2c114096b0c01e1cbaadb021c30a04d7dd5b41ab277bcd51246ca135bf931d4c4c796ecae7a4fef6d744ecef36ea - languageName: node - linkType: hard - "vlq@npm:^1.0.0": version: 1.0.1 resolution: "vlq@npm:1.0.1" @@ -19824,36 +19767,16 @@ resolve@~1.7.1: languageName: node linkType: hard -"w3c-hr-time@npm:^1.0.1, w3c-hr-time@npm:^1.0.2": - version: 1.0.2 - resolution: "w3c-hr-time@npm:1.0.2" - dependencies: - browser-process-hrtime: ^1.0.0 - checksum: ec3c2dacbf8050d917bbf89537a101a08c2e333b4c19155f7d3bedde43529d4339db6b3d049d9610789cb915f9515f8be037e0c54c079e9d4735c50b37ed52b9 - languageName: node - linkType: hard - -"w3c-xmlserializer@npm:^1.1.2": - version: 1.1.2 - resolution: "w3c-xmlserializer@npm:1.1.2" - dependencies: - domexception: ^1.0.1 - webidl-conversions: ^4.0.2 - xml-name-validator: ^3.0.0 - checksum: 1683e083d0dfc1529988f8956510a3a26e90738b41c4df0c7eb95283bfbeabeb492308117dcd32afef2a141e2a959ddf10ce562983d91b9f474a530b9dcdd337 - languageName: node - linkType: hard - -"w3c-xmlserializer@npm:^2.0.0": - version: 2.0.0 - resolution: "w3c-xmlserializer@npm:2.0.0" +"w3c-xmlserializer@npm:^4.0.0": + version: 4.0.0 + resolution: "w3c-xmlserializer@npm:4.0.0" dependencies: - xml-name-validator: ^3.0.0 - checksum: ae25c51cf71f1fb2516df1ab33a481f83461a117565b95e3d0927432522323f93b1b2846cbb60196d337970c421adb604fc2d0d180c6a47a839da01db5b9973b + xml-name-validator: ^4.0.0 + checksum: eba070e78deb408ae8defa4d36b429f084b2b47a4741c4a9be3f27a0a3d1845e277e3072b04391a138f7e43776842627d1334e448ff13ff90ad9fb1214ee7091 languageName: node linkType: hard -"walker@npm:^1.0.7, walker@npm:~1.0.5": +"walker@npm:^1.0.7, walker@npm:^1.0.8, walker@npm:~1.0.5": version: 1.0.8 resolution: "walker@npm:1.0.8" dependencies: @@ -20031,13 +19954,6 @@ resolve@~1.7.1: languageName: node linkType: hard -"webidl-conversions@npm:^4.0.2": - version: 4.0.2 - resolution: "webidl-conversions@npm:4.0.2" - checksum: c93d8dfe908a0140a4ae9c0ebc87a33805b416a33ee638a605b551523eec94a9632165e54632f6d57a39c5f948c4bab10e0e066525e9a4b87a79f0d04fbca374 - languageName: node - linkType: hard - "webidl-conversions@npm:^5.0.0": version: 5.0.0 resolution: "webidl-conversions@npm:5.0.0" @@ -20045,10 +19961,10 @@ resolve@~1.7.1: languageName: node linkType: hard -"webidl-conversions@npm:^6.1.0": - version: 6.1.0 - resolution: "webidl-conversions@npm:6.1.0" - checksum: 1f526507aa491f972a0c1409d07f8444e1d28778dfa269a9971f2e157182f3d496dc33296e4ed45b157fdb3bf535bb90c90bf10c50dcf1dd6caacb2a34cc84fb +"webidl-conversions@npm:^7.0.0": + version: 7.0.0 + resolution: "webidl-conversions@npm:7.0.0" + checksum: f05588567a2a76428515333eff87200fae6c83c3948a7482ebb109562971e77ef6dc49749afa58abb993391227c5697b3ecca52018793e0cb4620a48f10bd21b languageName: node linkType: hard @@ -20066,12 +19982,12 @@ resolve@~1.7.1: languageName: node linkType: hard -"whatwg-encoding@npm:^1.0.1, whatwg-encoding@npm:^1.0.5": - version: 1.0.5 - resolution: "whatwg-encoding@npm:1.0.5" +"whatwg-encoding@npm:^2.0.0": + version: 2.0.0 + resolution: "whatwg-encoding@npm:2.0.0" dependencies: - iconv-lite: 0.4.24 - checksum: 5be4efe111dce29ddee3448d3915477fcc3b28f991d9cf1300b4e50d6d189010d47bca2f51140a844cf9b726e8f066f4aee72a04d687bfe4f2ee2767b2f5b1e6 + iconv-lite: 0.6.3 + checksum: 7087810c410aa9b689cbd6af8773341a53cdc1f3aae2a882c163bd5522ec8ca4cdfc269aef417a5792f411807d5d77d50df4c24e3abb00bb60192858a40cc675 languageName: node linkType: hard @@ -20082,10 +19998,20 @@ resolve@~1.7.1: languageName: node linkType: hard -"whatwg-mimetype@npm:^2.2.0, whatwg-mimetype@npm:^2.3.0": - version: 2.3.0 - resolution: "whatwg-mimetype@npm:2.3.0" - checksum: 23eb885940bcbcca4ff841c40a78e9cbb893ec42743993a42bf7aed16085b048b44b06f3402018931687153550f9a32d259dfa524e4f03577ab898b6965e5383 +"whatwg-mimetype@npm:^3.0.0": + version: 3.0.0 + resolution: "whatwg-mimetype@npm:3.0.0" + checksum: ce08bbb36b6aaf64f3a84da89707e3e6a31e5ab1c1a2379fd68df79ba712a4ab090904f0b50e6693b0dafc8e6343a6157e40bf18fdffd26e513cf95ee2a59824 + languageName: node + linkType: hard + +"whatwg-url@npm:^11.0.0": + version: 11.0.0 + resolution: "whatwg-url@npm:11.0.0" + dependencies: + tr46: ^3.0.0 + webidl-conversions: ^7.0.0 + checksum: ed4826aaa57e66bb3488a4b25c9cd476c46ba96052747388b5801f137dd740b73fde91ad207d96baf9f17fbcc80fc1a477ad65181b5eb5fa718d27c69501d7af languageName: node linkType: hard @@ -20099,28 +20025,6 @@ resolve@~1.7.1: languageName: node linkType: hard -"whatwg-url@npm:^7.0.0": - version: 7.1.0 - resolution: "whatwg-url@npm:7.1.0" - dependencies: - lodash.sortby: ^4.7.0 - tr46: ^1.0.1 - webidl-conversions: ^4.0.2 - checksum: fecb07c87290b47d2ec2fb6d6ca26daad3c9e211e0e531dd7566e7ff95b5b3525a57d4f32640ad4adf057717e0c215731db842ad761e61d947e81010e05cf5fd - languageName: node - linkType: hard - -"whatwg-url@npm:^8.0.0, whatwg-url@npm:^8.5.0": - version: 8.7.0 - resolution: "whatwg-url@npm:8.7.0" - dependencies: - lodash: ^4.7.0 - tr46: ^2.1.0 - webidl-conversions: ^6.1.0 - checksum: a87abcc6cefcece5311eb642858c8fdb234e51ec74196bfacf8def2edae1bfbffdf6acb251646ed6301f8cee44262642d8769c707256125a91387e33f405dd1e - languageName: node - linkType: hard - "whatwg-url@npm:~8.1.0": version: 8.1.0 resolution: "whatwg-url@npm:8.1.0" @@ -20371,6 +20275,16 @@ resolve@~1.7.1: languageName: node linkType: hard +"write-file-atomic@npm:^4.0.2": + version: 4.0.2 + resolution: "write-file-atomic@npm:4.0.2" + dependencies: + imurmurhash: ^0.1.4 + signal-exit: ^3.0.7 + checksum: 5da60bd4eeeb935eec97ead3df6e28e5917a6bd317478e4a85a5285e8480b8ed96032bbcc6ecd07b236142a24f3ca871c924ec4a6575e623ec1b11bf8c1c253c + languageName: node + linkType: hard + "write-json-file@npm:^3.2.0": version: 3.2.0 resolution: "write-json-file@npm:3.2.0" @@ -20406,7 +20320,7 @@ resolve@~1.7.1: languageName: node linkType: hard -"ws@npm:^7, ws@npm:^7.0.0, ws@npm:^7.4.5, ws@npm:^7.4.6": +"ws@npm:^7, ws@npm:^7.4.5": version: 7.5.9 resolution: "ws@npm:7.5.9" peerDependencies: @@ -20421,6 +20335,21 @@ resolve@~1.7.1: languageName: node linkType: hard +"ws@npm:^8.11.0": + version: 8.18.0 + resolution: "ws@npm:8.18.0" + peerDependencies: + bufferutil: ^4.0.1 + utf-8-validate: ">=5.0.2" + peerDependenciesMeta: + bufferutil: + optional: true + utf-8-validate: + optional: true + checksum: 91d4d35bc99ff6df483bdf029b9ea4bfd7af1f16fc91231a96777a63d263e1eabf486e13a2353970efc534f9faa43bdbf9ee76525af22f4752cbc5ebda333975 + languageName: node + linkType: hard + "ws@npm:^8.5.0": version: 8.14.2 resolution: "ws@npm:8.14.2" @@ -20510,10 +20439,10 @@ resolve@~1.7.1: languageName: node linkType: hard -"xml-name-validator@npm:^3.0.0": - version: 3.0.0 - resolution: "xml-name-validator@npm:3.0.0" - checksum: b3ac459afed783c285bb98e4960bd1f3ba12754fd4f2320efa0f9181ca28928c53cc75ca660d15d205e81f92304419afe94c531c7cfb3e0649aa6d140d53ecb0 +"xml-name-validator@npm:^4.0.0": + version: 4.0.0 + resolution: "xml-name-validator@npm:4.0.0" + checksum: af100b79c29804f05fa35aa3683e29a321db9b9685d5e5febda3fa1e40f13f85abc40f45a6b2bf7bee33f68a1dc5e8eaef4cec100a304a9db565e6061d4cb5ad languageName: node linkType: hard @@ -20524,7 +20453,7 @@ resolve@~1.7.1: languageName: node linkType: hard -"xmlchars@npm:^2.1.1, xmlchars@npm:^2.2.0": +"xmlchars@npm:^2.2.0": version: 2.2.0 resolution: "xmlchars@npm:2.2.0" checksum: 8c70ac94070ccca03f47a81fcce3b271bd1f37a591bf5424e787ae313fcb9c212f5f6786e1fa82076a2c632c0141552babcd85698c437506dfa6ae2d58723062 @@ -20610,13 +20539,6 @@ resolve@~1.7.1: languageName: node linkType: hard -"yargs-parser@npm:20.x, yargs-parser@npm:^20.2.2, yargs-parser@npm:^20.2.3": - version: 20.2.9 - resolution: "yargs-parser@npm:20.2.9" - checksum: 8bb69015f2b0ff9e17b2c8e6bfe224ab463dd00ca211eece72a4cd8a906224d2703fb8a326d36fdd0e68701e201b2a60ed7cf81ce0fd9b3799f9fe7745977ae3 - languageName: node - linkType: hard - "yargs-parser@npm:21.1.1, yargs-parser@npm:^21.1.1": version: 21.1.1 resolution: "yargs-parser@npm:21.1.1" @@ -20654,6 +20576,13 @@ resolve@~1.7.1: languageName: node linkType: hard +"yargs-parser@npm:^20.2.2, yargs-parser@npm:^20.2.3": + version: 20.2.9 + resolution: "yargs-parser@npm:20.2.9" + checksum: 8bb69015f2b0ff9e17b2c8e6bfe224ab463dd00ca211eece72a4cd8a906224d2703fb8a326d36fdd0e68701e201b2a60ed7cf81ce0fd9b3799f9fe7745977ae3 + languageName: node + linkType: hard + "yargs-parser@npm:^9.0.2": version: 9.0.2 resolution: "yargs-parser@npm:9.0.2" @@ -20683,7 +20612,7 @@ resolve@~1.7.1: languageName: node linkType: hard -"yargs@npm:17.7.2, yargs@npm:^17.6.2": +"yargs@npm:17.7.2, yargs@npm:^17.3.1, yargs@npm:^17.6.2": version: 17.7.2 resolution: "yargs@npm:17.7.2" dependencies: From dd691b63a452fa902ea01c29d9dc17230555ce1c Mon Sep 17 00:00:00 2001 From: Otabek Narzullaev Date: Wed, 27 Nov 2024 20:33:12 +0500 Subject: [PATCH 02/13] chore: replace browserEnv fn with jest.spyOn --- .../test/spec/iframe-controller/_post.spec.ts | 7 +- .../iframe-controller/hideOverlay.spec.ts | 7 +- .../test/spec/iframe-controller/init.spec.ts | 71 +++++++++---------- .../iframe-controller/showOverlay.spec.ts | 9 ++- 4 files changed, 45 insertions(+), 49 deletions(-) diff --git a/packages/magic-sdk/test/spec/iframe-controller/_post.spec.ts b/packages/magic-sdk/test/spec/iframe-controller/_post.spec.ts index 61cbeeb40..483eb57d9 100644 --- a/packages/magic-sdk/test/spec/iframe-controller/_post.spec.ts +++ b/packages/magic-sdk/test/spec/iframe-controller/_post.spec.ts @@ -1,12 +1,11 @@ -import browserEnv from '@ikscodes/browser-env'; import { createModalNotReadyError } from '@magic-sdk/provider'; import { createIframeController } from '../../factories'; beforeEach(() => { - browserEnv.restore(); - browserEnv.stub('addEventListener', jest.fn()); + jest.restoreAllMocks(); + jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); // Don't let JSDOM try to load the iframe - browserEnv.stub('document.body.appendChild', jest.fn()); + jest.spyOn(document.body, 'appendChild').mockImplementation(jest.fn()); }); test('Calls iframe.contentWindow.postMessage with the expected arguments', async () => { diff --git a/packages/magic-sdk/test/spec/iframe-controller/hideOverlay.spec.ts b/packages/magic-sdk/test/spec/iframe-controller/hideOverlay.spec.ts index 81c05f24f..f2473105a 100644 --- a/packages/magic-sdk/test/spec/iframe-controller/hideOverlay.spec.ts +++ b/packages/magic-sdk/test/spec/iframe-controller/hideOverlay.spec.ts @@ -1,11 +1,10 @@ -import browserEnv from '@ikscodes/browser-env'; import { createIframeController } from '../../factories'; import { IframeController } from '../../../src/iframe-controller'; beforeEach(() => { - browserEnv.restore(); - browserEnv.stub('addEventListener', jest.fn()); - browserEnv.stub('console.log', jest.fn()); + jest.restoreAllMocks(); + jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); + jest.spyOn(console, 'log').mockImplementation(jest.fn()); }); test('Change visibility style to `hidden` and opacity to 0', async () => { diff --git a/packages/magic-sdk/test/spec/iframe-controller/init.spec.ts b/packages/magic-sdk/test/spec/iframe-controller/init.spec.ts index f4cd67219..1fe86e2bf 100644 --- a/packages/magic-sdk/test/spec/iframe-controller/init.spec.ts +++ b/packages/magic-sdk/test/spec/iframe-controller/init.spec.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { IframeController } from '../../../src/iframe-controller'; import { ENCODED_QUERY_PARAMS, MAGIC_RELAYER_FULL_URL } from '../../constants'; import { createIframeController } from '../../factories'; @@ -34,19 +33,19 @@ function createOverlayElementsStub() { } beforeEach(() => { - browserEnv.restore(); + jest.restoreAllMocks(); (IframeController.prototype as any).listen = jest.fn(); }); test('Appends header with style, appends body with iframe, and resolves iframe', async () => { const { appendChildStub, classListAddStub, createElementStub } = createOverlayElementsStub(); - browserEnv.stub('addEventListener', jest.fn()); - browserEnv.stub('removeEventListener', jest.fn()); - browserEnv.stub('document.querySelectorAll', () => ({ length: 0 })); - browserEnv.stub('document.createElement', createElementStub); - browserEnv.stub('document.readyState', 'loaded'); - browserEnv.stub('document.body.appendChild', appendChildStub); + jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); + jest.spyOn(global, 'removeEventListener').mockImplementation(jest.fn()); + jest.spyOn(document, 'querySelectorAll').mockReturnValue({ length: 0 } as any); + jest.spyOn(document, 'createElement').mockImplementation(createElementStub); + jest.spyOn(document, 'readyState', 'get').mockReturnValue('complete'); + jest.spyOn(document.body, 'appendChild').mockImplementation(appendChildStub); const overlay = createIframeController(); const iframe = await (overlay as any).iframe; @@ -63,12 +62,12 @@ test('Appends header with style, appends body with iframe, and resolves iframe', test('Displays warning in console upon duplicate iframes', async () => { const { appendChildStub, createElementStub } = createOverlayElementsStub(); - browserEnv.stub('addEventListener', jest.fn()); - browserEnv.stub('removeEventListener', jest.fn()); - browserEnv.stub('document.querySelectorAll', () => [{ src: ENCODED_QUERY_PARAMS }]); - browserEnv.stub('document.createElement', createElementStub); - browserEnv.stub('document.readyState', 'loaded'); - browserEnv.stub('document.body.appendChild', appendChildStub); + jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); + jest.spyOn(global, 'removeEventListener').mockImplementation(jest.fn()); + jest.spyOn(document, 'querySelectorAll').mockReturnValue([{ src: ENCODED_QUERY_PARAMS }] as any); + jest.spyOn(document, 'createElement').mockImplementation(createElementStub); + jest.spyOn(document, 'readyState', 'get').mockReturnValue('complete'); + jest.spyOn(document.body, 'appendChild').mockImplementation(appendChildStub); const consoleWarnStub = jest.spyOn(console, 'warn').mockImplementation(); @@ -80,12 +79,12 @@ test('Displays warning in console upon duplicate iframes', async () => { test('Waits until `document` is loaded/ready', async () => { const { appendChildStub, createElementStub } = createOverlayElementsStub(); - browserEnv.stub('addEventListener', jest.fn()); - browserEnv.stub('removeEventListener', jest.fn()); - browserEnv.stub('document.querySelectorAll', () => ({ length: 0 })); - browserEnv.stub('document.createElement', createElementStub); - browserEnv.stub('document.readyState', 'initializing'); - browserEnv.stub('document.body.appendChild', appendChildStub); + jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); + jest.spyOn(global, 'removeEventListener').mockImplementation(jest.fn()); + jest.spyOn(document, 'querySelectorAll').mockReturnValue({ length: 0 } as any); + jest.spyOn(document, 'createElement').mockImplementation(createElementStub); + jest.spyOn(document, 'readyState', 'get').mockReturnValue('loading'); + jest.spyOn(document.body, 'appendChild').mockImplementation(appendChildStub); createIframeController(); @@ -96,12 +95,12 @@ test('Assumes the iframe is not yet initialized if `src` is `undefined`', async const { classListAddStub, createElementStub } = createOverlayElementsStub(); const appendChildStub = jest.fn(); - browserEnv.stub('addEventListener', jest.fn()); - browserEnv.stub('removeEventListener', jest.fn()); - browserEnv.stub('document.querySelectorAll', () => ({ length: 0 })); - browserEnv.stub('document.createElement', createElementStub); - browserEnv.stub('document.readyState', 'loaded'); - browserEnv.stub('document.body.appendChild', appendChildStub); + jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); + jest.spyOn(global, 'removeEventListener').mockImplementation(jest.fn()); + jest.spyOn(document, 'querySelectorAll').mockReturnValue({ length: 0 } as any); + jest.spyOn(document, 'createElement').mockImplementation(createElementStub); + jest.spyOn(document, 'readyState', 'get').mockReturnValue('complete'); + jest.spyOn(document.body, 'appendChild').mockImplementation(appendChildStub); const overlay = createIframeController(); const iframe = await (overlay as any).iframe; @@ -116,8 +115,8 @@ test('Assumes the iframe is not yet initialized if `src` is `undefined`', async test('Adds `message` event listener', () => { const addEventListenerStub = jest.fn(); - browserEnv.stub('addEventListener', addEventListenerStub); - browserEnv.stub('removeEventListener', jest.fn()); + jest.spyOn(global, 'addEventListener').mockImplementation(addEventListenerStub); + jest.spyOn(global, 'removeEventListener').mockImplementation(jest.fn()); createIframeController(); @@ -125,8 +124,8 @@ test('Adds `message` event listener', () => { }); test('Ignores events with different origin than expected', done => { - browserEnv.stub('addEventListener', jest.fn()); - browserEnv.stub('removeEventListener', jest.fn()); + jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); + jest.spyOn(global, 'removeEventListener').mockImplementation(jest.fn()); const viewController = createIframeController('http://asdf'); const onHandlerStub = jest.fn(); @@ -141,8 +140,8 @@ test('Ignores events with different origin than expected', done => { }); test('Ignores events with undefined `data` attribute', done => { - browserEnv.stub('addEventListener', jest.fn()); - browserEnv.stub('removeEventListener', jest.fn()); + jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); + jest.spyOn(global, 'removeEventListener').mockImplementation(jest.fn()); const viewController = createIframeController(); const onHandlerStub = jest.fn(); @@ -157,8 +156,8 @@ test('Ignores events with undefined `data` attribute', done => { }); test('Ignores events with undefined `data.msgType`', done => { - browserEnv.stub('addEventListener', jest.fn()); - browserEnv.stub('removeEventListener', jest.fn()); + jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); + jest.spyOn(global, 'removeEventListener').mockImplementation(jest.fn()); const viewController = createIframeController(); const onHandlerStub = jest.fn(); @@ -188,7 +187,7 @@ test('Executes events where `messageHandlers` size is > 0', done => { }); test('Ignores events where `messageHandlers` size is === 0', done => { - browserEnv.stub('location', new URL(MAGIC_RELAYER_FULL_URL)); + jest.spyOn(global, 'location', 'get').mockImplementation(() => new URL(MAGIC_RELAYER_FULL_URL) as any); const viewController = createIframeController(); (viewController as any).endpoint = ''; // Force `event.origin` and `this.endpoint` to be equivalent @@ -202,7 +201,7 @@ test('Ignores events where `messageHandlers` size is === 0', done => { }); test('Ignores events where `event.origin` and `this.endpoint` are not equivalent', done => { - browserEnv.stub('location', new URL(MAGIC_RELAYER_FULL_URL)); + jest.spyOn(global, 'location', 'get').mockImplementation(() => new URL(MAGIC_RELAYER_FULL_URL) as any); const viewController = createIframeController(); (viewController as any).messageHandlers = { size: 0 }; diff --git a/packages/magic-sdk/test/spec/iframe-controller/showOverlay.spec.ts b/packages/magic-sdk/test/spec/iframe-controller/showOverlay.spec.ts index 5b130474e..a743ce49c 100644 --- a/packages/magic-sdk/test/spec/iframe-controller/showOverlay.spec.ts +++ b/packages/magic-sdk/test/spec/iframe-controller/showOverlay.spec.ts @@ -1,11 +1,10 @@ -import browserEnv from '@ikscodes/browser-env'; import { createIframeController } from '../../factories'; import { IframeController } from '../../../src/iframe-controller'; beforeEach(() => { - browserEnv.restore(); - browserEnv.stub('addEventListener', jest.fn()); - browserEnv.stub('console.warn', jest.fn()); + jest.restoreAllMocks(); + jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); + jest.spyOn(console, 'warn').mockImplementation(jest.fn()); }); test('Change display style to `block`', async () => { @@ -56,7 +55,7 @@ test('Saves the current `document.activeElement`', async () => { const overlay = createIframeController(); - browserEnv.stub('document.activeElement', 'qwertyqwerty'); + jest.spyOn(document, 'activeElement', 'get').mockReturnValue('qwertyqwerty' as any); expect((overlay as any).activeElement).toBe(null); From 85ba0fef521be586040b89b6119d4b7c44b939ab Mon Sep 17 00:00:00 2001 From: Otabek Narzullaev Date: Thu, 28 Nov 2024 15:02:38 +0500 Subject: [PATCH 03/13] chore: add typescript-eslint rules for test files --- eslint.config.mjs | 9 ++++ packages/@magic-sdk/provider/test/setup.ts | 2 - .../json-rpc-response/applyError.spec.ts | 3 +- .../json-rpc-response/applyResult.spec.ts | 3 +- .../json-rpc-response/constructor.spec.ts | 3 +- .../sdk-exceptions/error-factories.spec.ts | 3 +- .../magic-extension-error/constructor.spec.ts | 3 +- .../constructor.spec.ts | 3 +- .../magic-extension-warning/log.spec.ts | 3 +- .../magic-rpc-error/constructor.spec.ts | 3 +- .../magic-sdk-error/constructor.spec.ts | 3 +- .../magic-sdk-warning/constructor.spec.ts | 3 +- .../magic-sdk-warning/log.spec.ts | 3 +- .../sdk-exceptions/warning-factories.spec.ts | 3 +- .../test/spec/core/sdk/constructor.spec.ts | 9 ++-- .../test/spec/core/sdk/overlay.spec.ts | 3 +- .../test/spec/core/sdk/preload.spec.ts | 3 +- .../core/view-controller/constructor.spec.ts | 3 +- .../spec/core/view-controller/listen.spec.ts | 9 ++-- .../test/spec/core/view-controller/on.spec.ts | 5 --- .../spec/core/view-controller/post.spec.ts | 5 +-- .../core/view-controller/waitForReady.spec.ts | 7 ++-- .../modules/auth/loginWithCredential.spec.ts | 9 ++-- .../modules/auth/loginWithEmailOTP.spec.ts | 3 +- .../auth/loginWithEmailOTPWhitelabel.spec.ts | 3 +- .../modules/auth/loginWithMagicLink.spec.ts | 3 +- .../spec/modules/auth/loginWithSms.spec.ts | 3 +- .../auth/loginWithSmsWhitelabel.spec.ts | 3 +- .../modules/auth/updateEmailWithUI.spec.ts | 3 +- .../auth/updateEmailWithUI.whitelabel.spec.ts | 3 +- .../auth/updatePhoneNumberWithUI.spec.ts | 3 +- .../base-extension/constructor.spec.ts | 3 +- .../createDeprecationWarning.spec.ts | 3 +- .../base-extension/createError.spec.ts | 3 +- .../base-extension/createWarning.spec.ts | 3 +- .../spec/modules/base-extension/init.spec.ts | 3 +- .../modules/base-module/constructor.spec.ts | 3 +- .../spec/modules/base-module/request.spec.ts | 5 +-- .../test/spec/modules/nft/checkout.spec.ts | 3 +- .../test/spec/modules/nft/purchase.spec.ts | 3 +- .../test/spec/modules/nft/transfer.spec.ts | 3 +- .../spec/modules/rpc-provider/enable.spec.ts | 2 - .../spec/modules/rpc-provider/request.spec.ts | 3 +- .../spec/modules/rpc-provider/send.spec.ts | 5 +-- .../modules/rpc-provider/sendAsync.spec.ts | 3 +- .../modules/user/emitUserLoggedOut.spec.ts | 5 --- .../spec/modules/user/generateIdToken.spec.ts | 3 +- .../test/spec/modules/user/getIdToken.spec.ts | 3 +- .../test/spec/modules/user/getInfo.spec.ts | 3 +- .../spec/modules/user/getMetadata.spec.ts | 3 +- .../test/spec/modules/user/isLoggedIn.spec.ts | 3 +- .../test/spec/modules/user/logout.spec.ts | 3 +- .../spec/modules/user/onUserLoggedOut.spec.ts | 5 --- .../spec/modules/user/recoverAccount.spec.ts | 3 +- .../modules/user/requestInfoWithUI.spec.ts | 3 +- .../modules/user/revealPrivateKey.spec.ts | 3 +- .../spec/modules/user/showSettings.spec.ts | 11 ++--- .../modules/user/updatePhoneNumber.spec.ts | 3 +- .../wallet/autoConnectIfWalletBrowser.spec.ts | 4 +- .../wallet/connectToCoinbaseWallet.spec.ts | 4 +- .../modules/wallet/connectToMetaMask.spec.ts | 4 +- .../wallet/connectToThirdPartyWallet.spec.ts | 4 +- .../spec/modules/wallet/connectWithUI.spec.ts | 3 +- .../spec/modules/wallet/disconnect.spec.ts | 3 +- .../wallet/getCoinbaseProvider.spec.ts | 3 +- .../test/spec/modules/wallet/getInfo.spec.ts | 3 +- .../wallet/getMetaMaskProvider.spec.ts | 3 +- .../wallet/getProvider-coinbase.spec.ts | 3 +- .../modules/wallet/getProvider-magic.spec.ts | 3 +- .../wallet/getProvider-metamask.spec.ts | 3 +- .../spec/modules/wallet/getUserEnv.spec.ts | 3 +- .../wallet/handleSelectedWallet.spec.ts | 3 +- .../wallet/isCoinbaseWalletBrowser.spec.ts | 3 +- .../wallet/isCoinbaseWalletInstalled.spec.ts | 3 +- .../modules/wallet/isMetaMaskBrowser.spec.ts | 3 +- .../wallet/isMetaMaskInstalled.spec.ts | 3 +- .../test/spec/modules/wallet/isMobile.spec.ts | 3 +- .../modules/wallet/isWalletEnabled.spec.ts | 3 +- .../wallet/requestUserInfoWithUI.spec.ts | 3 +- .../wallet/sendGaslessTransaction.spec.ts | 3 +- .../spec/modules/wallet/showAddress.spec.ts | 3 +- .../spec/modules/wallet/showBalances.spec.ts | 3 +- .../test/spec/modules/wallet/showNFTs.spec.ts | 3 +- .../spec/modules/wallet/showOnRamp.spec.ts | 3 +- .../modules/wallet/showSendTokensUI.spec.ts | 3 +- .../test/spec/modules/wallet/showUI.spec.ts | 3 +- .../util/events/createTypedEmitter.spec.ts | 3 +- .../events/typed-emitter/constructor.spec.ts | 5 --- .../promise-tools/createPromiEvent.spec.ts | 41 +++++++++---------- .../util/promise-tools/createPromise.spec.ts | 19 ++++----- .../util/promise-tools/isPromiEvent.spec.ts | 5 +-- .../provider/test/spec/util/storage.spec.ts | 5 +-- 92 files changed, 140 insertions(+), 246 deletions(-) diff --git a/eslint.config.mjs b/eslint.config.mjs index 727fa7206..2b8d0192b 100644 --- a/eslint.config.mjs +++ b/eslint.config.mjs @@ -72,4 +72,13 @@ export default [ }, }, }, + { + files: ['**/*.spec.*'], + + rules: { + '@typescript-eslint/no-explicit-any': 'off', + '@typescript-eslint/naming-convention': 'off', + '@typescript-eslint/use-unknown-in-catch-callback-variable': 'off', + }, + }, ]; diff --git a/packages/@magic-sdk/provider/test/setup.ts b/packages/@magic-sdk/provider/test/setup.ts index 7aff9f63d..2b3d8b3ac 100644 --- a/packages/@magic-sdk/provider/test/setup.ts +++ b/packages/@magic-sdk/provider/test/setup.ts @@ -1,9 +1,7 @@ // NOTE: This module is automatically included at the top of each test file. -import browserEnv from '@ikscodes/browser-env'; import { Crypto } from '@peculiar/webcrypto'; import { mockConsole } from '../../../../scripts/utils/mock-console'; -browserEnv(); (window as any).crypto = new Crypto(); beforeEach(() => { diff --git a/packages/@magic-sdk/provider/test/spec/core/json-rpc/json-rpc-response/applyError.spec.ts b/packages/@magic-sdk/provider/test/spec/core/json-rpc/json-rpc-response/applyError.spec.ts index 4ddf7bf4a..91c946158 100644 --- a/packages/@magic-sdk/provider/test/spec/core/json-rpc/json-rpc-response/applyError.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/json-rpc/json-rpc-response/applyError.spec.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { JsonRpcError, JsonRpcRequestPayload } from '@magic-sdk/types'; import { JsonRpcResponse } from '../../../../../src/core/json-rpc'; @@ -19,7 +18,7 @@ function createJsonRcpError(): JsonRpcError { } beforeEach(() => { - browserEnv.restore(); + jest.restoreAllMocks(); }); test('Add a formatted error to the response with `JsonRpcError` object as argument', () => { diff --git a/packages/@magic-sdk/provider/test/spec/core/json-rpc/json-rpc-response/applyResult.spec.ts b/packages/@magic-sdk/provider/test/spec/core/json-rpc/json-rpc-response/applyResult.spec.ts index 8be14d343..f823e3948 100644 --- a/packages/@magic-sdk/provider/test/spec/core/json-rpc/json-rpc-response/applyResult.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/json-rpc/json-rpc-response/applyResult.spec.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { JsonRpcRequestPayload } from '@magic-sdk/types'; import { JsonRpcResponse } from '../../../../../src/core/json-rpc'; @@ -12,7 +11,7 @@ function createSourcePayload(): JsonRpcRequestPayload { } beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Applies a result to the response.', () => { diff --git a/packages/@magic-sdk/provider/test/spec/core/json-rpc/json-rpc-response/constructor.spec.ts b/packages/@magic-sdk/provider/test/spec/core/json-rpc/json-rpc-response/constructor.spec.ts index c37bf228e..a519c6f98 100644 --- a/packages/@magic-sdk/provider/test/spec/core/json-rpc/json-rpc-response/constructor.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/json-rpc/json-rpc-response/constructor.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { JsonRpcResponse } from '../../../../../src/core/json-rpc'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Initialize JsonRpcResponse instance if argument is `instanceof` JsonRpcReponse', () => { diff --git a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/error-factories.spec.ts b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/error-factories.spec.ts index 376c4b690..1b0775964 100644 --- a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/error-factories.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/error-factories.spec.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { Extension } from '../../../../src/modules/base-extension'; import { mockSDKEnvironmentConstant, restoreSDKEnvironmentConstants } from '../../../mocks'; @@ -12,7 +11,7 @@ function errorAssertions(error: any, expectedCode: string, expectedMessage: stri beforeEach(() => { jest.resetModules(); - browserEnv.restore(); + jest.resetAllMocks(); restoreSDKEnvironmentConstants(); }); diff --git a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-extension-error/constructor.spec.ts b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-extension-error/constructor.spec.ts index 709380ead..75a70f050 100644 --- a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-extension-error/constructor.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-extension-error/constructor.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicExtensionError } from '../../../../../src/core/sdk-exceptions'; import { Extension } from '../../../../../src/modules/base-extension'; beforeEach(() => { - browserEnv(); + jest.resetAllMocks(); }); class TestExtension extends Extension<'test'> { diff --git a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-extension-warning/constructor.spec.ts b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-extension-warning/constructor.spec.ts index 4e1c228f9..c82dbb53d 100644 --- a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-extension-warning/constructor.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-extension-warning/constructor.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicExtensionWarning } from '../../../../../src/core/sdk-exceptions'; import { Extension } from '../../../../../src/modules/base-extension'; beforeEach(() => { - browserEnv(); + jest.resetAllMocks(); }); class TestExtension extends Extension<'test'> { diff --git a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-extension-warning/log.spec.ts b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-extension-warning/log.spec.ts index 8ba6b2bae..9ef537791 100644 --- a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-extension-warning/log.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-extension-warning/log.spec.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicExtensionWarning } from '../../../../../src/core/sdk-exceptions'; import { Extension } from '../../../../../src/modules/base-extension'; @@ -10,7 +9,7 @@ test('`MagicSDKWarning.log` logs message to `console.warn`', async () => { const ext = new TestExtension(); const warning = new MagicExtensionWarning(ext, 'TEST_CODE' as any, 'test message'); const consoleWarningStub = jest.fn(); - browserEnv.stub('console.warn', consoleWarningStub); + jest.spyOn(console, 'warn').mockImplementation(consoleWarningStub); warning.log(); expect(consoleWarningStub.mock.calls[0][0]).toBe('Magic Extension Warning (test): [TEST_CODE] test message'); diff --git a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-rpc-error/constructor.spec.ts b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-rpc-error/constructor.spec.ts index 70ee8db23..8c5970eaa 100644 --- a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-rpc-error/constructor.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-rpc-error/constructor.spec.ts @@ -1,11 +1,10 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicRPCError } from '../../../../../src/core/sdk-exceptions'; const exampleData = '0x08c379a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000011555345525f554e52454749535445524544000000000000000000000000000000'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Initialize `MagicRPCError` with object argument', () => { diff --git a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-sdk-error/constructor.spec.ts b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-sdk-error/constructor.spec.ts index 7721f3d67..d6b2b0217 100644 --- a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-sdk-error/constructor.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-sdk-error/constructor.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicSDKError } from '../../../../../src/core/sdk-exceptions'; beforeEach(() => { - browserEnv(); + jest.resetAllMocks(); }); test('Instantiate `MagicSDKError`', () => { diff --git a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-sdk-warning/constructor.spec.ts b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-sdk-warning/constructor.spec.ts index 43aade0f9..3a830ce3c 100644 --- a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-sdk-warning/constructor.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-sdk-warning/constructor.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicSDKWarning } from '../../../../../src/core/sdk-exceptions'; beforeEach(() => { - browserEnv(); + jest.resetAllMocks(); }); test('Instantiate `MagicSDKWarning`', () => { diff --git a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-sdk-warning/log.spec.ts b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-sdk-warning/log.spec.ts index 995f77ce2..79c69d8e5 100644 --- a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-sdk-warning/log.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-sdk-warning/log.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicSDKWarning } from '../../../../../src/core/sdk-exceptions'; test('`MagicSDKWarning.log` logs message to `console.warn`', async () => { const warning = new MagicSDKWarning('TEST_CODE' as any, 'test message'); const consoleWarningStub = jest.fn(); - browserEnv.stub('console.warn', consoleWarningStub); + jest.spyOn(console, 'warn').mockImplementation(consoleWarningStub); warning.log(); expect(consoleWarningStub.mock.calls[0][0]).toBe('Magic SDK Warning: [TEST_CODE] test message'); diff --git a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/warning-factories.spec.ts b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/warning-factories.spec.ts index 707f05dde..3eb8e7676 100644 --- a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/warning-factories.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/warning-factories.spec.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { mockSDKEnvironmentConstant, restoreSDKEnvironmentConstants } from '../../../mocks'; function warningAssertions(warning: any, expectedCode: string, expectedMessage: string) { @@ -11,7 +10,7 @@ function warningAssertions(warning: any, expectedCode: string, expectedMessage: beforeEach(() => { jest.resetModules(); - browserEnv.restore(); + jest.resetAllMocks(); restoreSDKEnvironmentConstants(); }); diff --git a/packages/@magic-sdk/provider/test/spec/core/sdk/constructor.spec.ts b/packages/@magic-sdk/provider/test/spec/core/sdk/constructor.spec.ts index 5f29a4287..e862cd991 100644 --- a/packages/@magic-sdk/provider/test/spec/core/sdk/constructor.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/sdk/constructor.spec.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { MAGIC_RELAYER_FULL_URL, TEST_API_KEY } from '../../../constants'; import { createMagicSDKCtor } from '../../../factories'; import { AuthModule } from '../../../../src/modules/auth'; @@ -7,7 +6,7 @@ import { RPCProviderModule } from '../../../../src/modules/rpc-provider'; import { Extension } from '../../../../src/modules/base-extension'; beforeEach(() => { - browserEnv.restore(); + jest.restoreAllMocks(); jest.resetAllMocks(); }); @@ -65,7 +64,7 @@ test('Initialize `MagicSDK` with custom endpoint', () => { }); test('Initialize `MagicSDK` when `window.location` is missing', () => { - browserEnv.stub('location', undefined); + jest.spyOn(window, 'location', 'get').mockReturnValue(undefined); const Ctor = createMagicSDKCtor(); const magic = new Ctor(TEST_API_KEY); @@ -324,7 +323,7 @@ test('Initialize `MagicSDK` with incompatible Expo React Native extension (versi test('Warns upon construction of `MagicSDK` instance if `endpoint` parameter is provided with `react-native` target.', () => { const Ctor = createMagicSDKCtor({ platform: 'react-native' }); const consoleWarnStub = jest.fn(); - browserEnv.stub('console.warn', consoleWarnStub); + jest.spyOn(console, 'warn').mockImplementation(consoleWarnStub); const { createReactNativeEndpointConfigurationWarning } = require('../../../../src/core/sdk-exceptions'); const expectedWarning = createReactNativeEndpointConfigurationWarning(); new Ctor(TEST_API_KEY, { endpoint: 'https://example.com' } as any); @@ -334,7 +333,7 @@ test('Warns upon construction of `MagicSDK` instance if `endpoint` parameter is test('Does not warn upon construction of `MagicSDK` instance if `endpoint` parameter is omitted with `react-native` target.', () => { const Ctor = createMagicSDKCtor({ platform: 'react-native' }); const consoleWarnStub = jest.fn(); - browserEnv.stub('console.warn', consoleWarnStub); + jest.spyOn(console, 'warn').mockImplementation(consoleWarnStub); new Ctor(TEST_API_KEY); expect(consoleWarnStub).not.toBeCalled(); }); diff --git a/packages/@magic-sdk/provider/test/spec/core/sdk/overlay.spec.ts b/packages/@magic-sdk/provider/test/spec/core/sdk/overlay.spec.ts index 1fce69404..21f5e3a52 100644 --- a/packages/@magic-sdk/provider/test/spec/core/sdk/overlay.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/sdk/overlay.spec.ts @@ -1,11 +1,10 @@ -import browserEnv from '@ikscodes/browser-env'; import { TEST_API_KEY } from '../../../constants'; import { ViewController } from '../../../../src/core/view-controller'; import { createMagicSDKCtor } from '../../../factories'; import { SDKBase } from '../../../../src/core/sdk'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('`MagicSDK.overlay` is lazy loaded', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/core/sdk/preload.spec.ts b/packages/@magic-sdk/provider/test/spec/core/sdk/preload.spec.ts index 972b873da..c21768c7e 100644 --- a/packages/@magic-sdk/provider/test/spec/core/sdk/preload.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/sdk/preload.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { ViewController } from '../../../../src/core/view-controller'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); (ViewController as any).prototype.waitForReady = jest.fn().mockImplementation(() => Promise.resolve()); }); diff --git a/packages/@magic-sdk/provider/test/spec/core/view-controller/constructor.spec.ts b/packages/@magic-sdk/provider/test/spec/core/view-controller/constructor.spec.ts index deff3d22e..129c598ca 100644 --- a/packages/@magic-sdk/provider/test/spec/core/view-controller/constructor.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/view-controller/constructor.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { ViewController } from '../../../../src/core/view-controller'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Instantiates `ViewController`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/core/view-controller/listen.spec.ts b/packages/@magic-sdk/provider/test/spec/core/view-controller/listen.spec.ts index f10252a98..743d1f8d2 100644 --- a/packages/@magic-sdk/provider/test/spec/core/view-controller/listen.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/view-controller/listen.spec.ts @@ -1,13 +1,12 @@ -import browserEnv from '@ikscodes/browser-env'; import { createViewController } from '../../../factories'; import { MSG_TYPES } from '../../../constants'; import { MagicSDKWarning } from '../../../../src/core/sdk-exceptions'; beforeEach(() => { - browserEnv(); + jest.resetAllMocks(); }); -test('Receive MAGIC_HIDE_OVERLAY, call `hideOverlay`', (done) => { +test('Receive MAGIC_HIDE_OVERLAY, call `hideOverlay`', done => { const overlay = createViewController(''); const hideOverlayStub = jest.fn(); overlay.hideOverlay = hideOverlayStub; @@ -20,7 +19,7 @@ test('Receive MAGIC_HIDE_OVERLAY, call `hideOverlay`', (done) => { }, 0); }); -test('Receive MAGIC_SHOW_OVERLAY, call `showOverlay`', (done) => { +test('Receive MAGIC_SHOW_OVERLAY, call `showOverlay`', done => { const overlay = createViewController(''); const showOverlayStub = jest.fn(); overlay.showOverlay = showOverlayStub; @@ -33,7 +32,7 @@ test('Receive MAGIC_SHOW_OVERLAY, call `showOverlay`', (done) => { }, 0); }); -test('Receive MAGIC_SEND_PRODUCT_ANNOUNCEMENT, log product announcement', (done) => { +test('Receive MAGIC_SEND_PRODUCT_ANNOUNCEMENT, log product announcement', done => { const overlay = createViewController(''); const productAnnouncement = 'New feature available!'; const logSpy = jest.spyOn(MagicSDKWarning.prototype, 'log'); diff --git a/packages/@magic-sdk/provider/test/spec/core/view-controller/on.spec.ts b/packages/@magic-sdk/provider/test/spec/core/view-controller/on.spec.ts index 1150fefaf..ae606991d 100644 --- a/packages/@magic-sdk/provider/test/spec/core/view-controller/on.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/view-controller/on.spec.ts @@ -1,11 +1,6 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicIncomingWindowMessage } from '@magic-sdk/types'; import { createViewController } from '../../../factories'; -beforeEach(() => { - browserEnv(); -}); - /** * We start with 3 listeners whenever a `ViewController` is created. */ diff --git a/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts b/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts index 1c178047b..37b2e77ee 100644 --- a/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicIncomingWindowMessage, MagicOutgoingWindowMessage, JsonRpcRequestPayload } from '@magic-sdk/types'; import { createViewController, TestViewController } from '../../../factories'; import { JsonRpcResponse } from '../../../../src/core/json-rpc'; @@ -73,13 +72,13 @@ let FAKE_STORE: any = {}; let viewController: TestViewController; beforeEach(() => { + jest.resetAllMocks(); jest.restoreAllMocks(); createJwtStub = jest.spyOn(webCryptoUtils, 'createJwt'); getDecryptedDeviceShareStub = jest.spyOn(deviceShareWebCryptoUtils, 'getDecryptedDeviceShare'); clearDeviceSharesStub = jest.spyOn(deviceShareWebCryptoUtils, 'clearDeviceShares'); jest.spyOn(global.console, 'info').mockImplementation(() => {}); - browserEnv(); - browserEnv.stub('addEventListener', jest.fn()); + jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); jest.spyOn(storage, 'getItem').mockImplementation((key: string) => FAKE_STORE[key]); jest.spyOn(storage, 'setItem').mockImplementation(async (key: string, value: any) => { FAKE_STORE[key] = value; diff --git a/packages/@magic-sdk/provider/test/spec/core/view-controller/waitForReady.spec.ts b/packages/@magic-sdk/provider/test/spec/core/view-controller/waitForReady.spec.ts index 057980d53..db3b6c07f 100644 --- a/packages/@magic-sdk/provider/test/spec/core/view-controller/waitForReady.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/view-controller/waitForReady.spec.ts @@ -1,12 +1,11 @@ -import browserEnv from '@ikscodes/browser-env'; import { createViewController } from '../../../factories'; import { MSG_TYPES } from '../../../constants'; beforeEach(() => { - browserEnv(); + jest.resetAllMocks(); }); -test('Receive MAGIC_OVERLAY_READY, resolve `waitForReady` promise', (done) => { +test('Receive MAGIC_OVERLAY_READY, resolve `waitForReady` promise', done => { const overlay = createViewController(''); const waitForReady = (overlay as any).waitForReady(); @@ -17,7 +16,7 @@ test('Receive MAGIC_OVERLAY_READY, resolve `waitForReady` promise', (done) => { window.postMessage({ msgType: MSG_TYPES().MAGIC_OVERLAY_READY }, '*'); }); -test('Resolve `waitForReady` promise after timeout', (done) => { +test('Resolve `waitForReady` promise after timeout', done => { jest.useFakeTimers(); const overlay = createViewController(''); const waitForReady = (overlay as any).waitForReady(); diff --git a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithCredential.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithCredential.spec.ts index 1c2022894..ab29d6fbe 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithCredential.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithCredential.spec.ts @@ -1,11 +1,10 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicPayloadMethod } from '@magic-sdk/types'; import { isPromiEvent } from '../../../../src/util'; import { createMagicSDK, createMagicSDKTestMode } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); jest.restoreAllMocks(); }); @@ -25,13 +24,13 @@ test('If no parameters are given & platform target is "web", URL search string a const magic = createMagicSDK({ platform: 'web' }); magic.auth.request = jest.fn(); - browserEnv.stub('window.history.replaceState', () => {}); + jest.spyOn(window.history, 'replaceState').mockImplementation(() => {}); - browserEnv.stub('window.location', { + jest.spyOn(window, 'location', 'get').mockReturnValue({ search: '?magic_credential=asdf', origin: 'http://example.com', pathname: '/hello/world', - }); + } as any); await magic.auth.loginWithCredential(); diff --git a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithEmailOTP.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithEmailOTP.spec.ts index 0cb278887..8a187b7f3 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithEmailOTP.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithEmailOTP.spec.ts @@ -1,11 +1,10 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicPayloadMethod } from '@magic-sdk/types'; import { isPromiEvent } from '../../../../src/util'; import { createMagicSDK, createMagicSDKTestMode } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); jest.restoreAllMocks(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithEmailOTPWhitelabel.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithEmailOTPWhitelabel.spec.ts index ec5420441..5f169558c 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithEmailOTPWhitelabel.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithEmailOTPWhitelabel.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); jest.restoreAllMocks(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithMagicLink.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithMagicLink.spec.ts index 1487894c4..16132fc72 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithMagicLink.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithMagicLink.spec.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicPayloadMethod, SDKWarningCode } from '@magic-sdk/types'; import { SDKEnvironment } from '../../../../src/core/sdk-environment'; @@ -8,7 +7,7 @@ import * as SdkExceptions from '../../../../src/core/sdk-exceptions'; import { ProductConsolidationMethodRemovalVersions } from '../../../../src/modules/auth'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); jest.restoreAllMocks(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithSms.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithSms.spec.ts index 2f10f4e73..cb5fc18a6 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithSms.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithSms.spec.ts @@ -1,11 +1,10 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicPayloadMethod } from '@magic-sdk/types'; import { isPromiEvent } from '../../../../src/util'; import { createMagicSDK, createMagicSDKTestMode } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); jest.restoreAllMocks(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithSmsWhitelabel.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithSmsWhitelabel.spec.ts index 4a053672b..0b1f3ebf4 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithSmsWhitelabel.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithSmsWhitelabel.spec.ts @@ -1,11 +1,10 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicPayloadMethod } from '@magic-sdk/types'; import { isPromiEvent } from '../../../../src/util'; import { createMagicSDK, createMagicSDKTestMode } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); jest.restoreAllMocks(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/auth/updateEmailWithUI.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/auth/updateEmailWithUI.spec.ts index 5bdaf84a8..0e3a51d17 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/auth/updateEmailWithUI.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/auth/updateEmailWithUI.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK, createMagicSDKTestMode } from '../../../factories'; import { BaseModule } from '../../../../src/modules/base-module'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `magic_auth_update_email`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/auth/updateEmailWithUI.whitelabel.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/auth/updateEmailWithUI.whitelabel.spec.ts index c8446c91b..e8e7af216 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/auth/updateEmailWithUI.whitelabel.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/auth/updateEmailWithUI.whitelabel.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { RecencyCheckEventEmit, UpdateEmailEventEmit } from '@magic-sdk/types'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `magic_auth_update_email` whitelabel and start recency check', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/auth/updatePhoneNumberWithUI.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/auth/updatePhoneNumberWithUI.spec.ts index 03dfc491b..c73779e13 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/auth/updatePhoneNumberWithUI.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/auth/updatePhoneNumberWithUI.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK, createMagicSDKTestMode } from '../../../factories'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test.skip('Generate JSON RPC request payload with method `magic_auth_update_phone_number`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/base-extension/constructor.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/base-extension/constructor.spec.ts index 20c6704b8..2d83d6d6d 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/base-extension/constructor.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/base-extension/constructor.spec.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { createJsonRpcRequestPayload, standardizeJsonRpcRequestPayload } from '../../../../src/core/json-rpc'; import { createExtensionNotInitializedError } from '../../../../src/core/sdk-exceptions'; import { createMagicSDK } from '../../../factories'; @@ -7,7 +6,7 @@ import { BaseModule } from '../../../../src/modules/base-module'; import { createPromiEvent, encodeJSON, decodeJSON, isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); jest.restoreAllMocks(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/base-extension/createDeprecationWarning.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/base-extension/createDeprecationWarning.spec.ts index e21fdffda..fd43d036e 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/base-extension/createDeprecationWarning.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/base-extension/createDeprecationWarning.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicExtensionWarning } from '../../../../src/core/sdk-exceptions'; import { Extension } from '../../../../src/modules/base-extension'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Creates a `DEPRECATION_NOTICE` warning without `useInstead` suffix', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/base-extension/createError.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/base-extension/createError.spec.ts index 1833dc6a5..2eae540a6 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/base-extension/createError.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/base-extension/createError.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicExtensionError } from '../../../../src/core/sdk-exceptions'; import { Extension } from '../../../../src/modules/base-extension'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Creates a `MagicExtensionError`', () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/base-extension/createWarning.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/base-extension/createWarning.spec.ts index 84c1c67a4..26b524c5f 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/base-extension/createWarning.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/base-extension/createWarning.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicExtensionWarning } from '../../../../src/core/sdk-exceptions'; import { Extension } from '../../../../src/modules/base-extension'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Creates a `MagicExtensionWarning`', () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/base-extension/init.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/base-extension/init.spec.ts index 2620dcab1..7acf9b706 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/base-extension/init.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/base-extension/init.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { Extension } from '../../../../src/modules/base-extension'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('`baseExtension.init` is no-op if already initialized', () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/base-module/constructor.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/base-module/constructor.spec.ts index 9ce2de18b..e58c9da03 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/base-module/constructor.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/base-module/constructor.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { BaseModule } from '../../../../src/modules/base-module'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Initialize `BaseModule`', () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/base-module/request.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/base-module/request.spec.ts index 008845ee8..efc42bc10 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/base-module/request.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/base-module/request.spec.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { JsonRpcRequestPayload } from '@magic-sdk/types'; import { JsonRpcResponse } from '../../../../src/core/json-rpc'; import { createViewController, createMagicSDK } from '../../../factories'; @@ -29,9 +28,9 @@ const requestPayload: JsonRpcRequestPayload = { }; beforeEach(() => { - browserEnv.restore(); + jest.restoreAllMocks(); // Silence the "duplicate iframes" warning. - browserEnv.stub('console.warn', () => {}); + jest.spyOn(console, 'warn').mockImplementation(() => {}); }); test('Resolves with a successful response', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/nft/checkout.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/nft/checkout.spec.ts index 12670abf7..f16b2db61 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/nft/checkout.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/nft/checkout.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('checkout method should return a PromiEvent', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/nft/purchase.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/nft/purchase.spec.ts index 8e2de2d9c..e39d2f544 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/nft/purchase.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/nft/purchase.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `magic_nft_purchase`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/nft/transfer.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/nft/transfer.spec.ts index 28e44e952..0c4f38e74 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/nft/transfer.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/nft/transfer.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('transfer method should return a PromiEvent', () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/rpc-provider/enable.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/rpc-provider/enable.spec.ts index 11eb4b7f4..8149b06eb 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/rpc-provider/enable.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/rpc-provider/enable.spec.ts @@ -1,9 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { BaseModule } from '../../../../src/modules/base-module'; beforeEach(() => { - browserEnv.restore(); jest.restoreAllMocks(); (BaseModule as any).prototype.request = jest.fn(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/rpc-provider/request.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/rpc-provider/request.spec.ts index b77c945e7..e9bdeb934 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/rpc-provider/request.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/rpc-provider/request.spec.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { JsonRpcRequestPayload } from '@magic-sdk/types'; import { createMagicSDK, createMagicSDKTestMode } from '../../../factories'; import { BaseModule } from '../../../../src/modules/base-module'; @@ -11,7 +10,7 @@ const requestPayload: JsonRpcRequestPayload = { }; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); (BaseModule as any).prototype.request = jest.fn(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/rpc-provider/send.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/rpc-provider/send.spec.ts index cb0897a25..408ede435 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/rpc-provider/send.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/rpc-provider/send.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { RPCProviderModule } from '../../../../src/modules/rpc-provider'; import { createSynchronousWeb3MethodWarning } from '../../../../src/core/sdk-exceptions'; beforeEach(() => { - browserEnv.restore(); + jest.restoreAllMocks(); (RPCProviderModule as any).prototype.request = jest.fn(); (RPCProviderModule as any).prototype.sendAsync = jest.fn(); }); @@ -66,7 +65,7 @@ test('Sync (legacy behavior), with full RPC payload and no callback', async () = const magic = createMagicSDK(); const consoleWarnStub = jest.fn(); - browserEnv.stub('console.warn', consoleWarnStub); + jest.spyOn(console, 'warn').mockImplementation(consoleWarnStub); const result = magic.rpcProvider.send({ jsonrpc: '2.0', id: 1, method: 'eth_call', params: ['hello world'] }); const expectedWarning = createSynchronousWeb3MethodWarning(); diff --git a/packages/@magic-sdk/provider/test/spec/modules/rpc-provider/sendAsync.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/rpc-provider/sendAsync.spec.ts index 0822a5824..ceb545191 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/rpc-provider/sendAsync.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/rpc-provider/sendAsync.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { createInvalidArgumentError } from '../../../../src/core/sdk-exceptions'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Throws INVALID_ARGUMENT error if `onRequestCallback` argument is `undefined`', () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/user/emitUserLoggedOut.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/user/emitUserLoggedOut.spec.ts index f511692c6..32dd897b6 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/user/emitUserLoggedOut.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/user/emitUserLoggedOut.spec.ts @@ -1,10 +1,5 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; -beforeEach(() => { - browserEnv.restore(); -}); - test('emitUserLoggedOut emits event', () => { const magic = createMagicSDK(); const callbackMock = jest.fn(); diff --git a/packages/@magic-sdk/provider/test/spec/modules/user/generateIdToken.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/user/generateIdToken.spec.ts index 45583a18c..ec9f09826 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/user/generateIdToken.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/user/generateIdToken.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK, createMagicSDKTestMode } from '../../../factories'; import { BaseModule } from '../../../../src/modules/base-module'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `magic_auth_generate_id_token`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/user/getIdToken.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/user/getIdToken.spec.ts index 46b96fd22..7521c725c 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/user/getIdToken.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/user/getIdToken.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK, createMagicSDKTestMode } from '../../../factories'; import { BaseModule } from '../../../../src/modules/base-module'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `magic_auth_get_id_token`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/user/getInfo.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/user/getInfo.spec.ts index ed025344f..49dedd734 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/user/getInfo.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/user/getInfo.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { mockLocalForage } from '../../../mocks'; import * as storage from '../../../../src/util/storage'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); mockLocalForage(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/user/getMetadata.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/user/getMetadata.spec.ts index c182c1253..3c447035f 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/user/getMetadata.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/user/getMetadata.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK, createMagicSDKTestMode } from '../../../factories'; import { BaseModule } from '../../../../src/modules/base-module'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `magic_auth_get_metadata`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/user/isLoggedIn.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/user/isLoggedIn.spec.ts index f5053f9f5..f79a39a05 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/user/isLoggedIn.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/user/isLoggedIn.spec.ts @@ -1,11 +1,10 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK, createMagicSDKTestMode } from '../../../factories'; import { BaseModule } from '../../../../src/modules/base-module'; import { isPromiEvent, storage } from '../../../../src/util'; import { mockLocalForage } from '../../../mocks'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Resolves immediately when cached magic_auth_is_logged_in is true', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/user/logout.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/user/logout.spec.ts index 69ac3cceb..710e9c045 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/user/logout.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/user/logout.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { isPromiEvent, storage } from '../../../../src/util'; import { createMagicSDK, createMagicSDKTestMode } from '../../../factories'; import { mockLocalForage } from '../../../mocks'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `magic_auth_logout`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/user/onUserLoggedOut.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/user/onUserLoggedOut.spec.ts index b0d2755c3..8f4197284 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/user/onUserLoggedOut.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/user/onUserLoggedOut.spec.ts @@ -1,10 +1,5 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; -beforeEach(() => { - browserEnv.restore(); -}); - test('onUserLoggedOut adds callback', () => { const magic = createMagicSDK(); const callbackMock = jest.fn(); diff --git a/packages/@magic-sdk/provider/test/spec/modules/user/recoverAccount.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/user/recoverAccount.spec.ts index 1517c2a7d..82ac7d0ac 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/user/recoverAccount.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/user/recoverAccount.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK, createMagicSDKTestMode } from '../../../factories'; import { isPromiEvent } from '../../../../src'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `magic_auth_recover_account`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/user/requestInfoWithUI.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/user/requestInfoWithUI.spec.ts index 045c78167..0fb70f4f9 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/user/requestInfoWithUI.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/user/requestInfoWithUI.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `mc_request_user_info`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/user/revealPrivateKey.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/user/revealPrivateKey.spec.ts index a86836f80..1c96832d6 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/user/revealPrivateKey.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/user/revealPrivateKey.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `magic_reveal_key`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/user/showSettings.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/user/showSettings.spec.ts index 9f215d79a..c75f8e929 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/user/showSettings.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/user/showSettings.spec.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { DeepLinkPage } from '@magic-sdk/types/src/core/deep-link-pages'; import { createMagicSDK, createMagicSDKTestMode } from '../../../factories'; import { isPromiEvent } from '../../../../src/util'; @@ -14,7 +13,7 @@ jest.mock('@magic-sdk/types', () => ({ })); beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); jest.restoreAllMocks(); }); @@ -146,7 +145,7 @@ test('ShowSettings should call createIntermediaryEvent with StartEditPhoneNumber const createIntermediaryEventFn = jest.fn(); magic.user.createIntermediaryEvent = jest.fn(() => createIntermediaryEventFn); - const startEditPhoneNumberListener = mockOn.mock.calls.find((call) => call[0] === 'start-edit-phone-number')[1]; + const startEditPhoneNumberListener = mockOn.mock.calls.find(call => call[0] === 'start-edit-phone-number')[1]; startEditPhoneNumberListener(); @@ -165,7 +164,7 @@ test('ShowSettings should call createIntermediaryEvent with Cancel', () => { const createIntermediaryEventFn = jest.fn(); magic.user.createIntermediaryEvent = jest.fn(() => createIntermediaryEventFn); - const startEditPhoneNumberListener = mockOn.mock.calls.find((call) => call[0] === 'cancel')[1]; + const startEditPhoneNumberListener = mockOn.mock.calls.find(call => call[0] === 'cancel')[1]; startEditPhoneNumberListener(); @@ -305,9 +304,7 @@ test('ShowSettings should attach event listeners for VerifyEmailOtp event', () = const createIntermediaryEventFn = jest.fn(); magic.user.createIntermediaryEvent = jest.fn(() => createIntermediaryEventFn); - const verifyEmailOtpListener = mockOn.mock.calls.find( - (call) => call[0] === 'Recency/auth-factor-verify-email-otp', - )[1]; + const verifyEmailOtpListener = mockOn.mock.calls.find(call => call[0] === 'Recency/auth-factor-verify-email-otp')[1]; verifyEmailOtpListener(otp); diff --git a/packages/@magic-sdk/provider/test/spec/modules/user/updatePhoneNumber.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/user/updatePhoneNumber.spec.ts index a95b3e499..7fe782662 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/user/updatePhoneNumber.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/user/updatePhoneNumber.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK, createMagicSDKTestMode } from '../../../factories'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test.skip('Generate JSON RPC request payload with method `magic_auth_update_phone_number`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/autoConnectIfWalletBrowser.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/autoConnectIfWalletBrowser.spec.ts index cef1a0d65..0297b951a 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/autoConnectIfWalletBrowser.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/autoConnectIfWalletBrowser.spec.ts @@ -1,9 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv({ url: 'http://localhost' }); - browserEnv.restore(); + jest.resetAllMocks(); }); test('If metamask browser, wallet and address params should be populated', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/connectToCoinbaseWallet.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/connectToCoinbaseWallet.spec.ts index ae84c1272..061d20a40 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/connectToCoinbaseWallet.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/connectToCoinbaseWallet.spec.ts @@ -1,9 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv({ url: 'http://localhost' }); - browserEnv.restore(); + jest.resetAllMocks(); }); test('Returns connected wallet address in array and does not change the window.href', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/connectToMetaMask.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/connectToMetaMask.spec.ts index dd6b72ad2..dffbd0a3c 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/connectToMetaMask.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/connectToMetaMask.spec.ts @@ -1,9 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv({ url: 'http://localhost' }); - browserEnv.restore(); + jest.resetAllMocks(); }); test('Returns connected wallet address in array and does not change the window.href', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/connectToThirdPartyWallet.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/connectToThirdPartyWallet.spec.ts index 3eabed536..c4098ced7 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/connectToThirdPartyWallet.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/connectToThirdPartyWallet.spec.ts @@ -1,9 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv({ url: 'http://localhost' }); - browserEnv.restore(); + jest.resetAllMocks(); }); test('Throws error if invalid provider', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/connectWithUI.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/connectWithUI.spec.ts index 8f92d5dcf..31af27071 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/connectWithUI.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/connectWithUI.spec.ts @@ -1,11 +1,10 @@ -import browserEnv from '@ikscodes/browser-env'; import { Wallets } from '@magic-sdk/types'; import { ConnectWithUiEvents } from '../../../../src/modules/wallet'; import { createPromiEvent } from '../../../../src/util'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `mc_login` and `env` params as an object', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/disconnect.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/disconnect.spec.ts index 43ecea538..5ff4602c2 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/disconnect.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/disconnect.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `mc_disconnect`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/getCoinbaseProvider.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/getCoinbaseProvider.spec.ts index fdf250a97..578e816ec 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/getCoinbaseProvider.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/getCoinbaseProvider.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Return undefined if Coinbase is not installed', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/getInfo.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/getInfo.spec.ts index 7bc02eaf1..90efb383b 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/getInfo.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/getInfo.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import * as storage from '../../../../src/util/storage'; import { mockLocalForage } from '../../../mocks'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); mockLocalForage(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/getMetaMaskProvider.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/getMetaMaskProvider.spec.ts index 89dc05929..5e2f6105b 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/getMetaMaskProvider.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/getMetaMaskProvider.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Return undefined if MetaMask is not installed', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/getProvider-coinbase.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/getProvider-coinbase.spec.ts index f5b8f2b82..c23e9b3df 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/getProvider-coinbase.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/getProvider-coinbase.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { mockLocalForage } from '../../../mocks'; import * as storage from '../../../../src/util/storage'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); mockLocalForage(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/getProvider-magic.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/getProvider-magic.spec.ts index b5b4450c6..04ff166d0 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/getProvider-magic.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/getProvider-magic.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import * as storage from '../../../../src/util/storage'; import { mockLocalForage } from '../../../mocks'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); mockLocalForage(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/getProvider-metamask.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/getProvider-metamask.spec.ts index 04816768f..28099b268 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/getProvider-metamask.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/getProvider-metamask.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import * as storage from '../../../../src/util/storage'; import { mockLocalForage } from '../../../mocks'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); mockLocalForage(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/getUserEnv.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/getUserEnv.spec.ts index 0a875c146..f3b1513e2 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/getUserEnv.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/getUserEnv.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Returns env object with isMetaMaskInstalled true', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/handleSelectedWallet.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/handleSelectedWallet.spec.ts index ec10a4358..743cc12c5 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/handleSelectedWallet.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/handleSelectedWallet.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Sends `wallet_connected` intermediary event to iframe', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/isCoinbaseWalletBrowser.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/isCoinbaseWalletBrowser.spec.ts index ef99fed18..fbf7d5f80 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/isCoinbaseWalletBrowser.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/isCoinbaseWalletBrowser.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Returns true if provider.isCoinbaseBrowser is true', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/isCoinbaseWalletInstalled.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/isCoinbaseWalletInstalled.spec.ts index eb5585895..22cd750d0 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/isCoinbaseWalletInstalled.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/isCoinbaseWalletInstalled.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Return false if window.ethereum is undefined', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/isMetaMaskBrowser.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/isMetaMaskBrowser.spec.ts index c37bb8707..a14840c91 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/isMetaMaskBrowser.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/isMetaMaskBrowser.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Returns true if is mobile and metamask is installed', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/isMetaMaskInstalled.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/isMetaMaskInstalled.spec.ts index 1f605992a..ce4eadd51 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/isMetaMaskInstalled.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/isMetaMaskInstalled.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Return false if provider.isMetaMask is undefined', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/isMobile.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/isMobile.spec.ts index b37b68fd7..b36233018 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/isMobile.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/isMobile.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Returns true if navigator.userAgent includes a mobile user agent string', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/isWalletEnabled.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/isWalletEnabled.spec.ts index 5579d336d..879a1c1b5 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/isWalletEnabled.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/isWalletEnabled.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `mc_wallet`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/requestUserInfoWithUI.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/requestUserInfoWithUI.spec.ts index 11b2bb9b8..533179372 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/requestUserInfoWithUI.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/requestUserInfoWithUI.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `mc_request_user_info`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/sendGaslessTransaction.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/sendGaslessTransaction.spec.ts index 02f4588c0..141b3a3fa 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/sendGaslessTransaction.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/sendGaslessTransaction.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { GaslessTransactionRequest } from '@magic-sdk/types'; import { createMagicSDK } from '../../../factories'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `eth_sendGaslessTransaction`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/showAddress.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/showAddress.spec.ts index 151babb0e..c452d167e 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/showAddress.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/showAddress.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `magic_show_address`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/showBalances.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/showBalances.spec.ts index a40daf318..f2e4903d6 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/showBalances.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/showBalances.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `magic_show_balances`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/showNFTs.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/showNFTs.spec.ts index 95ba7e7a4..51c6fca27 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/showNFTs.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/showNFTs.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `magic_show_nfts`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/showOnRamp.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/showOnRamp.spec.ts index eaa829f26..182f738ee 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/showOnRamp.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/showOnRamp.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `magic_show_fiat_onramp`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/showSendTokensUI.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/showSendTokensUI.spec.ts index 93227ba19..4359d5d21 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/showSendTokensUI.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/showSendTokensUI.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `magic_show_send_tokens_ui`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/showUI.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/showUI.spec.ts index 786e38398..2575397a3 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/showUI.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/showUI.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../../factories'; import { isPromiEvent } from '../../../../src/util'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Generate JSON RPC request payload with method `magic_wallet`', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/util/events/createTypedEmitter.spec.ts b/packages/@magic-sdk/provider/test/spec/util/events/createTypedEmitter.spec.ts index c89abc32d..641658256 100644 --- a/packages/@magic-sdk/provider/test/spec/util/events/createTypedEmitter.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/events/createTypedEmitter.spec.ts @@ -1,8 +1,7 @@ -import browserEnv from '@ikscodes/browser-env'; import { TypedEmitter, createTypedEmitter } from '../../../../src/util/events'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Returns an object containing a `TypedEmitter` instance & two helper functions', () => { diff --git a/packages/@magic-sdk/provider/test/spec/util/events/typed-emitter/constructor.spec.ts b/packages/@magic-sdk/provider/test/spec/util/events/typed-emitter/constructor.spec.ts index c5260aff8..f67720d67 100644 --- a/packages/@magic-sdk/provider/test/spec/util/events/typed-emitter/constructor.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/events/typed-emitter/constructor.spec.ts @@ -1,11 +1,6 @@ -import browserEnv from '@ikscodes/browser-env'; import EventEmitter from 'eventemitter3'; import { TypedEmitter } from '../../../../../src/util/events'; -beforeEach(() => { - browserEnv.restore(); -}); - test('Initialize `TypedEmitter`', () => { const emitter = new TypedEmitter(); diff --git a/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts b/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts index 098dad8dc..6cfb5d809 100644 --- a/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { createPromiEvent } from '../../../../src/util/promise-tools'; import { TypedEmitter } from '../../../../src/util/events'; @@ -8,53 +7,53 @@ const typedEmitterMethods = [...chainingEmitterMethods, ...nonChainingEmitterMet const promiseMethods = ['then', 'catch', 'finally']; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Creates a native `Promise`', () => { - const p = createPromiEvent((resolve) => resolve()); + const p = createPromiEvent(resolve => resolve()); expect(p instanceof Promise).toBe(true); }); test('Attaches `TypedEmitter` methods to the initial value', () => { - const p = createPromiEvent((resolve) => resolve()); + const p = createPromiEvent(resolve => resolve()); - typedEmitterMethods.forEach((method) => { + typedEmitterMethods.forEach(method => { expect(typeof p[method] === 'function').toBe(true); }); }); test('Attaches `TypedEmitter` methods to `Promise.then` result', () => { - const p = createPromiEvent((resolve) => resolve()).then(); + const p = createPromiEvent(resolve => resolve()).then(); - typedEmitterMethods.forEach((method) => { + typedEmitterMethods.forEach(method => { expect(typeof p[method] === 'function').toBe(true); }); }); test('Attaches `TypedEmitter` methods to `Promise.catch` result', () => { - const p = createPromiEvent((resolve) => resolve()).catch(); + const p = createPromiEvent(resolve => resolve()).catch(); - typedEmitterMethods.forEach((method) => { + typedEmitterMethods.forEach(method => { expect(typeof p[method] === 'function').toBe(true); }); }); test('Attaches `TypedEmitter` methods to `Promise.finally` result', () => { - const p = createPromiEvent((resolve) => resolve()).catch(); + const p = createPromiEvent(resolve => resolve()).catch(); - typedEmitterMethods.forEach((method) => { + typedEmitterMethods.forEach(method => { expect(typeof p[method] === 'function').toBe(true); }); }); test('Attaches `Promise` methods to `TypedEmitter` results', () => { - chainingEmitterMethods.forEach((emitterMethod) => { + chainingEmitterMethods.forEach(emitterMethod => { const emitterStub = jest.spyOn(TypedEmitter.prototype, emitterMethod as any).mockImplementation(); - const p = createPromiEvent((resolve) => resolve())[emitterMethod](); + const p = createPromiEvent(resolve => resolve())[emitterMethod](); - promiseMethods.forEach((promiseMethod) => { + promiseMethods.forEach(promiseMethod => { expect(typeof p[promiseMethod] === 'function').toBe(true); }); @@ -63,29 +62,29 @@ test('Attaches `Promise` methods to `TypedEmitter` results', () => { }); }); -test('Emits "done" event upon Promise resolution', (done) => { - createPromiEvent((resolve) => resolve('hello')).on('done', (result) => { +test('Emits "done" event upon Promise resolution', done => { + createPromiEvent(resolve => resolve('hello')).on('done', result => { expect(result).toBe('hello'); done(); }); }); -test('Emits "settled" event upon Promise resolution', (done) => { - createPromiEvent((resolve) => resolve()).on('settled', () => { +test('Emits "settled" event upon Promise resolution', done => { + createPromiEvent(resolve => resolve()).on('settled', () => { done(); }); }); -test('Emits "error" event upon Promise reject', (done) => { +test('Emits "error" event upon Promise reject', done => { createPromiEvent((resolve, reject) => reject('goodbye')) - .on('error', (err) => { + .on('error', err => { expect(err).toBe('goodbye' as any); done(); }) .catch(() => {}); }); -test('Emits "settled" event upon Promise reject', (done) => { +test('Emits "settled" event upon Promise reject', done => { createPromiEvent((resolve, reject) => reject()) .on('settled', () => { done(); diff --git a/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromise.spec.ts b/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromise.spec.ts index 69ca84071..f83267624 100644 --- a/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromise.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromise.spec.ts @@ -1,41 +1,40 @@ -import browserEnv from '@ikscodes/browser-env'; import { createPromise } from '../../../../src/util/promise-tools'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Creates a native `Promise`', () => { - const p = createPromise((resolve) => resolve()); + const p = createPromise(resolve => resolve()); expect(p instanceof Promise).toBe(true); }); -test('Resolves the `Promise`', (done) => { - createPromise((resolve) => resolve()).then(() => { +test('Resolves the `Promise`', done => { + createPromise(resolve => resolve()).then(() => { done(); }); }); -test('Rejects the `Promise`', (done) => { +test('Rejects the `Promise`', done => { createPromise((resolve, reject) => reject()).catch(() => { done(); }); }); -test('Rejects the `Promise` if an async executor is given and throws', (done) => { +test('Rejects the `Promise` if an async executor is given and throws', done => { createPromise(async () => { throw new Error('Oops'); - }).catch((err) => { + }).catch(err => { expect(err.message).toBe('Oops'); done(); }); }); -test('Rejects the `Promise` if a sync executor is given and throws', (done) => { +test('Rejects the `Promise` if a sync executor is given and throws', done => { createPromise(() => { throw new Error('Oops'); - }).catch((err) => { + }).catch(err => { expect(err.message).toBe('Oops'); done(); }); diff --git a/packages/@magic-sdk/provider/test/spec/util/promise-tools/isPromiEvent.spec.ts b/packages/@magic-sdk/provider/test/spec/util/promise-tools/isPromiEvent.spec.ts index f94f839bb..b5b3c50bf 100644 --- a/packages/@magic-sdk/provider/test/spec/util/promise-tools/isPromiEvent.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/promise-tools/isPromiEvent.spec.ts @@ -1,12 +1,11 @@ -import browserEnv from '@ikscodes/browser-env'; import { createPromiEvent, isPromiEvent } from '../../../../src/util/promise-tools'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Returns `true` for valid `PromiEvent` object', () => { - const p = createPromiEvent((resolve) => resolve()); + const p = createPromiEvent(resolve => resolve()); expect(isPromiEvent(p)).toBe(true); }); diff --git a/packages/@magic-sdk/provider/test/spec/util/storage.spec.ts b/packages/@magic-sdk/provider/test/spec/util/storage.spec.ts index 04317af6d..67b227b18 100644 --- a/packages/@magic-sdk/provider/test/spec/util/storage.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/storage.spec.ts @@ -1,13 +1,12 @@ /* global LocalForageDbMethods */ -import browserEnv from '@ikscodes/browser-env'; import localForage from 'localforage'; import * as memoryDriver from 'localforage-driver-memory'; import { mockSDKEnvironmentConstant } from '../../mocks'; beforeEach(() => { - browserEnv.restore(); - browserEnv.stub('console.info', jest.fn()); // Silence LocalForage info logs + jest.restoreAllMocks(); + jest.spyOn(console, 'info').mockImplementation(jest.fn()); jest.resetModules(); mockSDKEnvironmentConstant({ From 729858d90cdc1c42429da6b90c27835f5c8b9d8f Mon Sep 17 00:00:00 2001 From: Otabek Narzullaev Date: Fri, 29 Nov 2024 17:03:52 +0500 Subject: [PATCH 04/13] chore: remove all browser-env package usage --- packages/@magic-ext/aptos/test/setup.ts | 3 --- .../aptos/test/spec/aptos-extension.spec.ts | 3 +-- .../aptos/test/spec/magic-aptos-wallet.spec.ts | 3 +-- packages/@magic-ext/aptos/test/tsconfig.json | 2 +- packages/@magic-ext/gdkms/test/setup.ts | 2 -- .../@magic-ext/gdkms/test/spec/gdkms.spec.ts | 3 +-- packages/@magic-ext/harmony/test/setup.ts | 3 --- .../harmony/test/spec/harmony.spec.ts | 3 +-- packages/@magic-ext/kadena/test/setup.ts | 3 --- .../@magic-ext/kadena/test/spec/kadena.spec.ts | 3 +-- packages/@magic-ext/sui/test/setup.ts | 3 --- packages/@magic-ext/sui/test/spec/sui.spec.ts | 3 +-- .../react-native-bare/test/factories.ts | 3 +-- .../@magic-sdk/react-native-bare/test/setup.ts | 11 ----------- .../spec/react-native-sdk-base/Relayer.spec.ts | 3 +-- .../_post.spec.ts | 3 +-- .../handleReactNativeWebViewMessage.spec.ts | 17 ++++++++--------- .../hideOverlay.spec.ts | 3 +-- .../init.spec.ts | 3 +-- .../showOverlay.spec.ts | 3 +-- .../react-native-expo/test/factories.ts | 3 +-- .../@magic-sdk/react-native-expo/test/setup.ts | 11 ----------- .../spec/react-native-sdk-base/Relayer.spec.ts | 3 +-- .../_post.spec.ts | 3 +-- .../handleReactNativeWebViewMessage.spec.ts | 17 ++++++++--------- .../hideOverlay.spec.ts | 3 +-- .../init.spec.ts | 3 +-- .../showOverlay.spec.ts | 3 +-- .../bin/scaffold/template/hybrid/test/setup.ts | 2 -- .../scaffold/template/hybrid/test/tsconfig.json | 2 +- .../bin/scaffold/template/hybrid/tsconfig.json | 2 +- .../template/react-native/test/setup.ts | 2 -- .../template/react-native/test/tsconfig.json | 2 +- .../template/react-native/tsconfig.json | 2 +- scripts/bin/scaffold/template/web/test/setup.ts | 2 -- .../scaffold/template/web/test/tsconfig.json | 2 +- scripts/bin/scaffold/template/web/tsconfig.json | 2 +- 37 files changed, 41 insertions(+), 103 deletions(-) diff --git a/packages/@magic-ext/aptos/test/setup.ts b/packages/@magic-ext/aptos/test/setup.ts index 8a91d5e73..6430bda21 100644 --- a/packages/@magic-ext/aptos/test/setup.ts +++ b/packages/@magic-ext/aptos/test/setup.ts @@ -1,9 +1,6 @@ // NOTE: This module is automatically included at the top of each test file. -import browserEnv from '@ikscodes/browser-env'; import { mockConsole } from '../../../../scripts/utils/mock-console'; -browserEnv(); - beforeEach(() => { mockConsole(); }); diff --git a/packages/@magic-ext/aptos/test/spec/aptos-extension.spec.ts b/packages/@magic-ext/aptos/test/spec/aptos-extension.spec.ts index edbdcbe2d..dfe07a4a8 100644 --- a/packages/@magic-ext/aptos/test/spec/aptos-extension.spec.ts +++ b/packages/@magic-ext/aptos/test/spec/aptos-extension.spec.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { BCS, TxnBuilderTypes } from 'aptos'; import { createMagicSDKWithExtension } from '../../../../@magic-sdk/provider/test/factories'; import { AptosExtension } from '../../src'; @@ -32,7 +31,7 @@ const MESSAGE_PAYLOAD = { }; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Construct GetAccount request with `aptos_getAccount`', async () => { diff --git a/packages/@magic-ext/aptos/test/spec/magic-aptos-wallet.spec.ts b/packages/@magic-ext/aptos/test/spec/magic-aptos-wallet.spec.ts index 85aa6a1b6..0c321811a 100644 --- a/packages/@magic-ext/aptos/test/spec/magic-aptos-wallet.spec.ts +++ b/packages/@magic-ext/aptos/test/spec/magic-aptos-wallet.spec.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { BCS, TxnBuilderTypes } from 'aptos'; import { createMagicSDKWithExtension } from '../../../../@magic-sdk/provider/test/factories'; import { AptosExtension, MagicAptosWallet } from '../../src'; @@ -33,7 +32,7 @@ const MOCK_ACCOUTN_INFO = { }; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Call connect()', async () => { diff --git a/packages/@magic-ext/aptos/test/tsconfig.json b/packages/@magic-ext/aptos/test/tsconfig.json index ef2de78d3..967dc1a17 100644 --- a/packages/@magic-ext/aptos/test/tsconfig.json +++ b/packages/@magic-ext/aptos/test/tsconfig.json @@ -1,3 +1,3 @@ { - "extends": "../../../../tsconfig.settings.test.json", + "extends": "../../../../tsconfig.settings.test.json" } diff --git a/packages/@magic-ext/gdkms/test/setup.ts b/packages/@magic-ext/gdkms/test/setup.ts index 7aff9f63d..2b3d8b3ac 100644 --- a/packages/@magic-ext/gdkms/test/setup.ts +++ b/packages/@magic-ext/gdkms/test/setup.ts @@ -1,9 +1,7 @@ // NOTE: This module is automatically included at the top of each test file. -import browserEnv from '@ikscodes/browser-env'; import { Crypto } from '@peculiar/webcrypto'; import { mockConsole } from '../../../../scripts/utils/mock-console'; -browserEnv(); (window as any).crypto = new Crypto(); beforeEach(() => { diff --git a/packages/@magic-ext/gdkms/test/spec/gdkms.spec.ts b/packages/@magic-ext/gdkms/test/spec/gdkms.spec.ts index 83ebb37a4..623da6706 100644 --- a/packages/@magic-ext/gdkms/test/spec/gdkms.spec.ts +++ b/packages/@magic-ext/gdkms/test/spec/gdkms.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { MagicPayloadMethod } from '@magic-sdk/types'; import { createMagicSDKWithExtension } from '../../../../@magic-sdk/provider/test/factories'; import { GDKMSExtension } from '../../src'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Construct Encrypt Request with `magic_auth_encrypt_v1`', async () => { diff --git a/packages/@magic-ext/harmony/test/setup.ts b/packages/@magic-ext/harmony/test/setup.ts index 8a91d5e73..6430bda21 100644 --- a/packages/@magic-ext/harmony/test/setup.ts +++ b/packages/@magic-ext/harmony/test/setup.ts @@ -1,9 +1,6 @@ // NOTE: This module is automatically included at the top of each test file. -import browserEnv from '@ikscodes/browser-env'; import { mockConsole } from '../../../../scripts/utils/mock-console'; -browserEnv(); - beforeEach(() => { mockConsole(); }); diff --git a/packages/@magic-ext/harmony/test/spec/harmony.spec.ts b/packages/@magic-ext/harmony/test/spec/harmony.spec.ts index 34d30fd64..abf741b19 100644 --- a/packages/@magic-ext/harmony/test/spec/harmony.spec.ts +++ b/packages/@magic-ext/harmony/test/spec/harmony.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { HarmonyPayloadMethod } from '../../src/types'; import { createMagicSDKWithExtension } from '../../../../@magic-sdk/provider/test/factories'; import { HarmonyExtension } from '../../src'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Sends params as payload', async () => { diff --git a/packages/@magic-ext/kadena/test/setup.ts b/packages/@magic-ext/kadena/test/setup.ts index 8a91d5e73..6430bda21 100644 --- a/packages/@magic-ext/kadena/test/setup.ts +++ b/packages/@magic-ext/kadena/test/setup.ts @@ -1,9 +1,6 @@ // NOTE: This module is automatically included at the top of each test file. -import browserEnv from '@ikscodes/browser-env'; import { mockConsole } from '../../../../scripts/utils/mock-console'; -browserEnv(); - beforeEach(() => { mockConsole(); }); diff --git a/packages/@magic-ext/kadena/test/spec/kadena.spec.ts b/packages/@magic-ext/kadena/test/spec/kadena.spec.ts index 63018ab1f..ea1f7eaba 100644 --- a/packages/@magic-ext/kadena/test/spec/kadena.spec.ts +++ b/packages/@magic-ext/kadena/test/spec/kadena.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { KadenaPayloadMethod } from '../../src/types'; import { createMagicSDKWithExtension } from '../../../../@magic-sdk/provider/test/factories'; import { KadenaExtension } from '../../src'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Sends params as payload', () => { diff --git a/packages/@magic-ext/sui/test/setup.ts b/packages/@magic-ext/sui/test/setup.ts index 8a91d5e73..6430bda21 100644 --- a/packages/@magic-ext/sui/test/setup.ts +++ b/packages/@magic-ext/sui/test/setup.ts @@ -1,9 +1,6 @@ // NOTE: This module is automatically included at the top of each test file. -import browserEnv from '@ikscodes/browser-env'; import { mockConsole } from '../../../../scripts/utils/mock-console'; -browserEnv(); - beforeEach(() => { mockConsole(); }); diff --git a/packages/@magic-ext/sui/test/spec/sui.spec.ts b/packages/@magic-ext/sui/test/spec/sui.spec.ts index 5afb05948..3a0aea8e2 100644 --- a/packages/@magic-ext/sui/test/spec/sui.spec.ts +++ b/packages/@magic-ext/sui/test/spec/sui.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { SuiExtension } from '../../src/index'; import { SuiPayloadMethod } from '../../src/types'; import { createMagicSDKWithExtension } from '../../../../@magic-sdk/provider/test/factories'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); }); test('Sends params as payload', async () => { diff --git a/packages/@magic-sdk/react-native-bare/test/factories.ts b/packages/@magic-sdk/react-native-bare/test/factories.ts index ba3df6ddb..c499a1cec 100644 --- a/packages/@magic-sdk/react-native-bare/test/factories.ts +++ b/packages/@magic-sdk/react-native-bare/test/factories.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { MAGIC_RELAYER_FULL_URL, ENCODED_QUERY_PARAMS, TEST_API_KEY } from './constants'; export function createReactNativeWebViewController(endpoint = MAGIC_RELAYER_FULL_URL) { @@ -10,6 +9,6 @@ export function createReactNativeWebViewController(endpoint = MAGIC_RELAYER_FULL export function createMagicSDK(endpoint = MAGIC_RELAYER_FULL_URL) { const { Magic } = jest.requireActual('../src/index.ts'); - browserEnv.stub('console.warn', jest.fn()); + jest.spyOn(console, 'warn').mockImplementation(jest.fn()); return new Magic(TEST_API_KEY, { endpoint }); } diff --git a/packages/@magic-sdk/react-native-bare/test/setup.ts b/packages/@magic-sdk/react-native-bare/test/setup.ts index ab7f9ef1d..843256114 100644 --- a/packages/@magic-sdk/react-native-bare/test/setup.ts +++ b/packages/@magic-sdk/react-native-bare/test/setup.ts @@ -2,23 +2,12 @@ import 'regenerator-runtime/runtime'; -import browserEnv from '@ikscodes/browser-env'; import mockAsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock'; import { removeReactDependencies } from './mocks'; import { mockConsole } from '../../../../scripts/utils/mock-console'; jest.mock('@react-native-async-storage/async-storage', () => mockAsyncStorage); -browserEnv([ - 'setTimeout', - 'clearTimeout', - 'postMessage', - 'addEventListener', - 'removeEventListener', - 'document', - 'console', - 'window', -]); beforeEach(() => { mockConsole(); }); diff --git a/packages/@magic-sdk/react-native-bare/test/spec/react-native-sdk-base/Relayer.spec.ts b/packages/@magic-sdk/react-native-bare/test/spec/react-native-sdk-base/Relayer.spec.ts index 4ccc97385..31e2bf2e2 100644 --- a/packages/@magic-sdk/react-native-bare/test/spec/react-native-sdk-base/Relayer.spec.ts +++ b/packages/@magic-sdk/react-native-bare/test/spec/react-native-sdk-base/Relayer.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../factories'; import { reactNativeStyleSheetStub } from '../../mocks'; beforeEach(() => { - browserEnv.restore(); + jest.restoreAllMocks(); reactNativeStyleSheetStub(); }); diff --git a/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/_post.spec.ts b/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/_post.spec.ts index 6c7158c19..a6e653277 100644 --- a/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/_post.spec.ts +++ b/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/_post.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { createModalNotReadyError } from '@magic-sdk/provider'; import { createReactNativeWebViewController } from '../../factories'; import { reactNativeStyleSheetStub } from '../../mocks'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); reactNativeStyleSheetStub(); }); diff --git a/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/handleReactNativeWebViewMessage.spec.ts b/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/handleReactNativeWebViewMessage.spec.ts index a2fa65684..360a16dda 100644 --- a/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/handleReactNativeWebViewMessage.spec.ts +++ b/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/handleReactNativeWebViewMessage.spec.ts @@ -1,12 +1,11 @@ -import browserEnv from '@ikscodes/browser-env'; import { ENCODED_QUERY_PARAMS } from '../../constants'; import { createReactNativeWebViewController } from '../../factories'; beforeEach(() => { - browserEnv(); + jest.resetAllMocks(); }); -test('Ignores events with different origin than expected', (done) => { +test('Ignores events with different origin than expected', done => { const viewController = createReactNativeWebViewController('asdf'); const onHandlerStub = jest.fn(); viewController.messageHandlers.add(onHandlerStub); @@ -24,7 +23,7 @@ test('Ignores events with different origin than expected', (done) => { }, 100); }); -test('Ignores events with non-string data', (done) => { +test('Ignores events with non-string data', done => { const viewController = createReactNativeWebViewController('asdf'); const onHandlerStub = jest.fn(); viewController.messageHandlers.add(onHandlerStub); @@ -42,7 +41,7 @@ test('Ignores events with non-string data', (done) => { }, 100); }); -test('Replaces `undefined` or `null` response with an empty object', (done) => { +test('Replaces `undefined` or `null` response with an empty object', done => { const viewController = createReactNativeWebViewController('asdf'); const onHandlerStub = jest.fn(); viewController.messageHandlers.add(onHandlerStub); @@ -61,7 +60,7 @@ test('Replaces `undefined` or `null` response with an empty object', (done) => { }, 100); }); -test('Executes event handlers where `messageHandlers` size is > 0', (done) => { +test('Executes event handlers where `messageHandlers` size is > 0', done => { const viewController = createReactNativeWebViewController('asdf'); const onHandlerStub = jest.fn(); viewController.messageHandlers.add(onHandlerStub); @@ -80,7 +79,7 @@ test('Executes event handlers where `messageHandlers` size is > 0', (done) => { }, 100); }); -test('Ignores event handlers where `messageHandlers` size is === 0', (done) => { +test('Ignores event handlers where `messageHandlers` size is === 0', done => { const viewController = createReactNativeWebViewController('asdf'); viewController.messageHandlers = { size: 0 }; @@ -96,7 +95,7 @@ test('Ignores event handlers where `messageHandlers` size is === 0', (done) => { }, 100); }); -test('Process Typed Array in Solana Payload', (done) => { +test('Process Typed Array in Solana Payload', done => { const viewController = createReactNativeWebViewController('asdf'); const onHandlerStub = jest.fn(); @@ -130,7 +129,7 @@ test('Process Typed Array in Solana Payload', (done) => { }, 100); }); -test('Process Typed Array in Solana Payload', (done) => { +test('Process Typed Array in Solana Payload', done => { const viewController = createReactNativeWebViewController('asdf'); const onHandlerStub = jest.fn(); diff --git a/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/hideOverlay.spec.ts b/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/hideOverlay.spec.ts index 8b196273c..1fcf12458 100644 --- a/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/hideOverlay.spec.ts +++ b/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/hideOverlay.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createReactNativeWebViewController } from '../../factories'; import { reactNativeStyleSheetStub } from '../../mocks'; beforeEach(() => { - browserEnv(); + jest.resetAllMocks(); reactNativeStyleSheetStub(); }); diff --git a/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/init.spec.ts b/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/init.spec.ts index d2c6d9b69..52f4d2960 100644 --- a/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/init.spec.ts +++ b/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/init.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createReactNativeWebViewController } from '../../factories'; import { reactNativeStyleSheetStub } from '../../mocks'; beforeEach(() => { - browserEnv(); + jest.resetAllMocks(); }); test("Intializes 'webView' with null", () => { diff --git a/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/showOverlay.spec.ts b/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/showOverlay.spec.ts index 74ed3d508..efc1cc64d 100644 --- a/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/showOverlay.spec.ts +++ b/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/showOverlay.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createReactNativeWebViewController } from '../../factories'; import { reactNativeStyleSheetStub } from '../../mocks'; beforeEach(() => { - browserEnv(); + jest.resetAllMocks(); reactNativeStyleSheetStub(); }); diff --git a/packages/@magic-sdk/react-native-expo/test/factories.ts b/packages/@magic-sdk/react-native-expo/test/factories.ts index ba3df6ddb..c499a1cec 100644 --- a/packages/@magic-sdk/react-native-expo/test/factories.ts +++ b/packages/@magic-sdk/react-native-expo/test/factories.ts @@ -1,4 +1,3 @@ -import browserEnv from '@ikscodes/browser-env'; import { MAGIC_RELAYER_FULL_URL, ENCODED_QUERY_PARAMS, TEST_API_KEY } from './constants'; export function createReactNativeWebViewController(endpoint = MAGIC_RELAYER_FULL_URL) { @@ -10,6 +9,6 @@ export function createReactNativeWebViewController(endpoint = MAGIC_RELAYER_FULL export function createMagicSDK(endpoint = MAGIC_RELAYER_FULL_URL) { const { Magic } = jest.requireActual('../src/index.ts'); - browserEnv.stub('console.warn', jest.fn()); + jest.spyOn(console, 'warn').mockImplementation(jest.fn()); return new Magic(TEST_API_KEY, { endpoint }); } diff --git a/packages/@magic-sdk/react-native-expo/test/setup.ts b/packages/@magic-sdk/react-native-expo/test/setup.ts index ab7f9ef1d..843256114 100644 --- a/packages/@magic-sdk/react-native-expo/test/setup.ts +++ b/packages/@magic-sdk/react-native-expo/test/setup.ts @@ -2,23 +2,12 @@ import 'regenerator-runtime/runtime'; -import browserEnv from '@ikscodes/browser-env'; import mockAsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock'; import { removeReactDependencies } from './mocks'; import { mockConsole } from '../../../../scripts/utils/mock-console'; jest.mock('@react-native-async-storage/async-storage', () => mockAsyncStorage); -browserEnv([ - 'setTimeout', - 'clearTimeout', - 'postMessage', - 'addEventListener', - 'removeEventListener', - 'document', - 'console', - 'window', -]); beforeEach(() => { mockConsole(); }); diff --git a/packages/@magic-sdk/react-native-expo/test/spec/react-native-sdk-base/Relayer.spec.ts b/packages/@magic-sdk/react-native-expo/test/spec/react-native-sdk-base/Relayer.spec.ts index 4ccc97385..5e3f15780 100644 --- a/packages/@magic-sdk/react-native-expo/test/spec/react-native-sdk-base/Relayer.spec.ts +++ b/packages/@magic-sdk/react-native-expo/test/spec/react-native-sdk-base/Relayer.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createMagicSDK } from '../../factories'; import { reactNativeStyleSheetStub } from '../../mocks'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); reactNativeStyleSheetStub(); }); diff --git a/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/_post.spec.ts b/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/_post.spec.ts index 6c7158c19..a6e653277 100644 --- a/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/_post.spec.ts +++ b/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/_post.spec.ts @@ -1,10 +1,9 @@ -import browserEnv from '@ikscodes/browser-env'; import { createModalNotReadyError } from '@magic-sdk/provider'; import { createReactNativeWebViewController } from '../../factories'; import { reactNativeStyleSheetStub } from '../../mocks'; beforeEach(() => { - browserEnv.restore(); + jest.resetAllMocks(); reactNativeStyleSheetStub(); }); diff --git a/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/handleReactNativeWebViewMessage.spec.ts b/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/handleReactNativeWebViewMessage.spec.ts index a2fa65684..360a16dda 100644 --- a/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/handleReactNativeWebViewMessage.spec.ts +++ b/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/handleReactNativeWebViewMessage.spec.ts @@ -1,12 +1,11 @@ -import browserEnv from '@ikscodes/browser-env'; import { ENCODED_QUERY_PARAMS } from '../../constants'; import { createReactNativeWebViewController } from '../../factories'; beforeEach(() => { - browserEnv(); + jest.resetAllMocks(); }); -test('Ignores events with different origin than expected', (done) => { +test('Ignores events with different origin than expected', done => { const viewController = createReactNativeWebViewController('asdf'); const onHandlerStub = jest.fn(); viewController.messageHandlers.add(onHandlerStub); @@ -24,7 +23,7 @@ test('Ignores events with different origin than expected', (done) => { }, 100); }); -test('Ignores events with non-string data', (done) => { +test('Ignores events with non-string data', done => { const viewController = createReactNativeWebViewController('asdf'); const onHandlerStub = jest.fn(); viewController.messageHandlers.add(onHandlerStub); @@ -42,7 +41,7 @@ test('Ignores events with non-string data', (done) => { }, 100); }); -test('Replaces `undefined` or `null` response with an empty object', (done) => { +test('Replaces `undefined` or `null` response with an empty object', done => { const viewController = createReactNativeWebViewController('asdf'); const onHandlerStub = jest.fn(); viewController.messageHandlers.add(onHandlerStub); @@ -61,7 +60,7 @@ test('Replaces `undefined` or `null` response with an empty object', (done) => { }, 100); }); -test('Executes event handlers where `messageHandlers` size is > 0', (done) => { +test('Executes event handlers where `messageHandlers` size is > 0', done => { const viewController = createReactNativeWebViewController('asdf'); const onHandlerStub = jest.fn(); viewController.messageHandlers.add(onHandlerStub); @@ -80,7 +79,7 @@ test('Executes event handlers where `messageHandlers` size is > 0', (done) => { }, 100); }); -test('Ignores event handlers where `messageHandlers` size is === 0', (done) => { +test('Ignores event handlers where `messageHandlers` size is === 0', done => { const viewController = createReactNativeWebViewController('asdf'); viewController.messageHandlers = { size: 0 }; @@ -96,7 +95,7 @@ test('Ignores event handlers where `messageHandlers` size is === 0', (done) => { }, 100); }); -test('Process Typed Array in Solana Payload', (done) => { +test('Process Typed Array in Solana Payload', done => { const viewController = createReactNativeWebViewController('asdf'); const onHandlerStub = jest.fn(); @@ -130,7 +129,7 @@ test('Process Typed Array in Solana Payload', (done) => { }, 100); }); -test('Process Typed Array in Solana Payload', (done) => { +test('Process Typed Array in Solana Payload', done => { const viewController = createReactNativeWebViewController('asdf'); const onHandlerStub = jest.fn(); diff --git a/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/hideOverlay.spec.ts b/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/hideOverlay.spec.ts index 8b196273c..1fcf12458 100644 --- a/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/hideOverlay.spec.ts +++ b/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/hideOverlay.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createReactNativeWebViewController } from '../../factories'; import { reactNativeStyleSheetStub } from '../../mocks'; beforeEach(() => { - browserEnv(); + jest.resetAllMocks(); reactNativeStyleSheetStub(); }); diff --git a/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/init.spec.ts b/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/init.spec.ts index d2c6d9b69..52f4d2960 100644 --- a/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/init.spec.ts +++ b/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/init.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createReactNativeWebViewController } from '../../factories'; import { reactNativeStyleSheetStub } from '../../mocks'; beforeEach(() => { - browserEnv(); + jest.resetAllMocks(); }); test("Intializes 'webView' with null", () => { diff --git a/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/showOverlay.spec.ts b/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/showOverlay.spec.ts index 74ed3d508..efc1cc64d 100644 --- a/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/showOverlay.spec.ts +++ b/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/showOverlay.spec.ts @@ -1,9 +1,8 @@ -import browserEnv from '@ikscodes/browser-env'; import { createReactNativeWebViewController } from '../../factories'; import { reactNativeStyleSheetStub } from '../../mocks'; beforeEach(() => { - browserEnv(); + jest.resetAllMocks(); reactNativeStyleSheetStub(); }); diff --git a/scripts/bin/scaffold/template/hybrid/test/setup.ts b/scripts/bin/scaffold/template/hybrid/test/setup.ts index 3d42db491..9b39e0aff 100644 --- a/scripts/bin/scaffold/template/hybrid/test/setup.ts +++ b/scripts/bin/scaffold/template/hybrid/test/setup.ts @@ -1,8 +1,6 @@ // NOTE: This module is automatically included at the top of each test file. -import browserEnv from '@ikscodes/browser-env'; import { mockConsole } from "../../../../../utils/mock-console"; -browserEnv(); beforeEach(() => { mockConsole(); }); diff --git a/scripts/bin/scaffold/template/hybrid/test/tsconfig.json b/scripts/bin/scaffold/template/hybrid/test/tsconfig.json index ef2de78d3..7daa49ce5 100644 --- a/scripts/bin/scaffold/template/hybrid/test/tsconfig.json +++ b/scripts/bin/scaffold/template/hybrid/test/tsconfig.json @@ -1,3 +1,3 @@ { - "extends": "../../../../tsconfig.settings.test.json", + "extends": "../../../../../../tsconfig.settings.test.json", } diff --git a/scripts/bin/scaffold/template/hybrid/tsconfig.json b/scripts/bin/scaffold/template/hybrid/tsconfig.json index c268bce54..f3f27c7cd 100644 --- a/scripts/bin/scaffold/template/hybrid/tsconfig.json +++ b/scripts/bin/scaffold/template/hybrid/tsconfig.json @@ -1,4 +1,4 @@ { - "extends": "../../../tsconfig.settings.json", + "extends": "../../../../../tsconfig.settings.json", } diff --git a/scripts/bin/scaffold/template/react-native/test/setup.ts b/scripts/bin/scaffold/template/react-native/test/setup.ts index 3d42db491..9b39e0aff 100644 --- a/scripts/bin/scaffold/template/react-native/test/setup.ts +++ b/scripts/bin/scaffold/template/react-native/test/setup.ts @@ -1,8 +1,6 @@ // NOTE: This module is automatically included at the top of each test file. -import browserEnv from '@ikscodes/browser-env'; import { mockConsole } from "../../../../../utils/mock-console"; -browserEnv(); beforeEach(() => { mockConsole(); }); diff --git a/scripts/bin/scaffold/template/react-native/test/tsconfig.json b/scripts/bin/scaffold/template/react-native/test/tsconfig.json index ef2de78d3..7daa49ce5 100644 --- a/scripts/bin/scaffold/template/react-native/test/tsconfig.json +++ b/scripts/bin/scaffold/template/react-native/test/tsconfig.json @@ -1,3 +1,3 @@ { - "extends": "../../../../tsconfig.settings.test.json", + "extends": "../../../../../../tsconfig.settings.test.json", } diff --git a/scripts/bin/scaffold/template/react-native/tsconfig.json b/scripts/bin/scaffold/template/react-native/tsconfig.json index c268bce54..f3f27c7cd 100644 --- a/scripts/bin/scaffold/template/react-native/tsconfig.json +++ b/scripts/bin/scaffold/template/react-native/tsconfig.json @@ -1,4 +1,4 @@ { - "extends": "../../../tsconfig.settings.json", + "extends": "../../../../../tsconfig.settings.json", } diff --git a/scripts/bin/scaffold/template/web/test/setup.ts b/scripts/bin/scaffold/template/web/test/setup.ts index 3d42db491..9b39e0aff 100644 --- a/scripts/bin/scaffold/template/web/test/setup.ts +++ b/scripts/bin/scaffold/template/web/test/setup.ts @@ -1,8 +1,6 @@ // NOTE: This module is automatically included at the top of each test file. -import browserEnv from '@ikscodes/browser-env'; import { mockConsole } from "../../../../../utils/mock-console"; -browserEnv(); beforeEach(() => { mockConsole(); }); diff --git a/scripts/bin/scaffold/template/web/test/tsconfig.json b/scripts/bin/scaffold/template/web/test/tsconfig.json index ef2de78d3..7daa49ce5 100644 --- a/scripts/bin/scaffold/template/web/test/tsconfig.json +++ b/scripts/bin/scaffold/template/web/test/tsconfig.json @@ -1,3 +1,3 @@ { - "extends": "../../../../tsconfig.settings.test.json", + "extends": "../../../../../../tsconfig.settings.test.json", } diff --git a/scripts/bin/scaffold/template/web/tsconfig.json b/scripts/bin/scaffold/template/web/tsconfig.json index c268bce54..f3f27c7cd 100644 --- a/scripts/bin/scaffold/template/web/tsconfig.json +++ b/scripts/bin/scaffold/template/web/tsconfig.json @@ -1,4 +1,4 @@ { - "extends": "../../../tsconfig.settings.json", + "extends": "../../../../../tsconfig.settings.json", } From d19a151e48606985a92052e0c3676f384c9fefb9 Mon Sep 17 00:00:00 2001 From: sherzod-bakhodirov Date: Fri, 13 Dec 2024 15:05:09 +0500 Subject: [PATCH 05/13] fix: provider tests --- packages/@magic-sdk/provider/test/mocks.ts | 2 +- .../json-rpc-response/applyError.spec.ts | 4 +- .../sdk-exceptions/error-factories.spec.ts | 3 ++ .../test/spec/core/sdk/constructor.spec.ts | 9 ++-- .../spec/core/view-controller/post.spec.ts | 11 ++--- .../modules/auth/loginWithMagicLink.spec.ts | 2 +- .../auth/loginWithSmsWhitelabel.spec.ts | 4 ++ .../spec/modules/base-module/request.spec.ts | 8 ++-- .../spec/modules/user/showSettings.spec.ts | 6 ++- .../spec/modules/wallet/connectWithUI.spec.ts | 4 +- .../spec/util/device-share-web-crypto.spec.ts | 44 +++++++++---------- .../promise-tools/createPromiEvent.spec.ts | 38 +++++++++------- .../util/promise-tools/createPromise.spec.ts | 4 +- .../util/promise-tools/isPromiEvent.spec.ts | 2 +- .../isJsonRpcRequestPayload.spec.ts | 2 +- .../test/spec/util/web-crypto.spec.ts | 12 +++-- 16 files changed, 91 insertions(+), 64 deletions(-) diff --git a/packages/@magic-sdk/provider/test/mocks.ts b/packages/@magic-sdk/provider/test/mocks.ts index 80ab2a6f9..4477964f4 100644 --- a/packages/@magic-sdk/provider/test/mocks.ts +++ b/packages/@magic-sdk/provider/test/mocks.ts @@ -25,7 +25,7 @@ export function restoreSDKEnvironmentConstants() { jest.unmock('../src/core/sdk-environment'); } -export function mockLocalForage(FAKE_STORE = {}) { +export function mockLocalForage(FAKE_STORE: { [key: string]: any } = {}) { jest.spyOn(storage, 'getItem').mockImplementation((key: string) => FAKE_STORE[key]); jest.spyOn(storage, 'setItem').mockImplementation(async (key: string, value: any) => { FAKE_STORE[key] = value; diff --git a/packages/@magic-sdk/provider/test/spec/core/json-rpc/json-rpc-response/applyError.spec.ts b/packages/@magic-sdk/provider/test/spec/core/json-rpc/json-rpc-response/applyError.spec.ts index 91c946158..ee4cc4eac 100644 --- a/packages/@magic-sdk/provider/test/spec/core/json-rpc/json-rpc-response/applyError.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/json-rpc/json-rpc-response/applyError.spec.ts @@ -1,4 +1,4 @@ -import { JsonRpcError, JsonRpcRequestPayload } from '@magic-sdk/types'; +import { JsonRpcError, JsonRpcRequestPayload, RPCErrorCode } from '@magic-sdk/types'; import { JsonRpcResponse } from '../../../../../src/core/json-rpc'; function createSourcePayload(): JsonRpcRequestPayload { @@ -13,7 +13,7 @@ function createSourcePayload(): JsonRpcRequestPayload { function createJsonRcpError(): JsonRpcError { return { message: 'hello wolrd', - code: 1, + code: RPCErrorCode.InternalError, }; } diff --git a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/error-factories.spec.ts b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/error-factories.spec.ts index 1b0775964..d604f0208 100644 --- a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/error-factories.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/error-factories.spec.ts @@ -116,6 +116,7 @@ class NoopExtSupportingWeb extends Extension<'noop'> { name = 'noop' as const; compat = { 'magic-sdk': '>1.0.0', + '@magic-sdk/react-native': false, '@magic-sdk/react-native-bare': false, '@magic-sdk/react-native-expo': false, }; @@ -126,6 +127,7 @@ class NoopExtSupportingBareReactNative extends Extension<'noop'> { name = 'noop' as const; compat = { 'magic-sdk': false, + '@magic-sdk/react-native': false, '@magic-sdk/react-native-bare': '>1.0.0', '@magic-sdk/react-native-expo': false, }; @@ -136,6 +138,7 @@ class NoopExtSupportingExpoReactNative extends Extension<'noop'> { name = 'noop' as const; compat = { 'magic-sdk': false, + '@magic-sdk/react-native': false, '@magic-sdk/react-native-bare': false, '@magic-sdk/react-native-expo': '>1.0.0', }; diff --git a/packages/@magic-sdk/provider/test/spec/core/sdk/constructor.spec.ts b/packages/@magic-sdk/provider/test/spec/core/sdk/constructor.spec.ts index e862cd991..7b1ceb530 100644 --- a/packages/@magic-sdk/provider/test/spec/core/sdk/constructor.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/sdk/constructor.spec.ts @@ -13,7 +13,7 @@ beforeEach(() => { function assertEncodedQueryParams(parameters: string, expectedParams: any = {}) { const defaultExpectedParams = { API_KEY: TEST_API_KEY, - DOMAIN_ORIGIN: 'null', + DOMAIN_ORIGIN: window.location ? window.location.origin : '', host: 'auth.magic.link', sdk: 'magic-sdk', version: '1.0.0-test', @@ -47,7 +47,7 @@ test('Fail to initialize `MagicSDK`', () => { const Ctor = createMagicSDKCtor(); new Ctor(undefined as any); } catch (err) { - expect(err.message).toBe( + expect((err as Error).message).toBe( 'Magic SDK Error: [MISSING_API_KEY] Please provide an API key that you acquired from the Magic developer dashboard.', ); } @@ -64,7 +64,7 @@ test('Initialize `MagicSDK` with custom endpoint', () => { }); test('Initialize `MagicSDK` when `window.location` is missing', () => { - jest.spyOn(window, 'location', 'get').mockReturnValue(undefined); + jest.spyOn(window, 'location', 'get').mockReturnValue(undefined as unknown as Location); const Ctor = createMagicSDKCtor(); const magic = new Ctor(TEST_API_KEY); @@ -127,6 +127,7 @@ class NoopExtSupportingWeb extends Extension<'noop'> { name = 'noop' as const; compat = { 'magic-sdk': '>1.0.0', + '@magic-sdk/react-native': false, '@magic-sdk/react-native-bare': false, '@magic-sdk/react-native-expo': false, }; @@ -137,6 +138,7 @@ class NoopExtSupportingBareReactNative extends Extension<'noop'> { name = 'noop' as const; compat = { 'magic-sdk': false, + '@magic-sdk/react-native': false, '@magic-sdk/react-native-bare': '>1.0.0', '@magic-sdk/react-native-expo': false, }; @@ -147,6 +149,7 @@ class NoopExtSupportingExpoReactNative extends Extension<'noop'> { name = 'noop' as const; compat = { 'magic-sdk': false, + '@magic-sdk/react-native': false, '@magic-sdk/react-native-bare': false, '@magic-sdk/react-native-expo': '>1.0.0', }; diff --git a/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts b/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts index 37b2e77ee..fa691d3e2 100644 --- a/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts @@ -41,7 +41,8 @@ function responseEvent(values: { result?: any; error?: any; id?: number; deviceS * `ViewController.post` logic). */ function stubViewController(viewController: any, events: [MagicIncomingWindowMessage, any][]) { - const timeouts = []; + // eslint-disable-next-line no-undef + const timeouts: NodeJS.Timeout[] = []; const handlerSpy = jest.fn(() => timeouts.forEach(t => t && clearTimeout(t))); const onSpy = jest.fn((msgType, handler) => { events.forEach((event, i) => { @@ -60,14 +61,14 @@ function stubViewController(viewController: any, events: [MagicIncomingWindowMes return { handlerSpy, onSpy, postSpy }; } -let createJwtStub; -let getDecryptedDeviceShareStub; -let clearDeviceSharesStub; +let createJwtStub: jest.SpyInstance, [], any>; +let getDecryptedDeviceShareStub: jest.SpyInstance>;; +let clearDeviceSharesStub: jest.SpyInstance, [], any>; const FAKE_JWT_TOKEN = 'hot tokens'; const FAKE_DEVICE_SHARE = 'fake device share'; const FAKE_RT = 'will freshen'; const FAKE_INJECTED_JWT = 'fake injected jwt'; -let FAKE_STORE: any = {}; +let FAKE_STORE: {[key: string]: any} = {}; let viewController: TestViewController; diff --git a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithMagicLink.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithMagicLink.spec.ts index 16132fc72..1159c3a58 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithMagicLink.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithMagicLink.spec.ts @@ -91,7 +91,7 @@ test('Throws error when the SDK version is 19 or higher', async () => { await magic.auth.loginWithMagicLink({ email: 'test' }); } catch (err) { // Check if the error message is as expected - expect(err.message).toBe( + expect((err as Error).message).toBe( 'loginWithMagicLink() is deprecated for this package, please utlize a passcode method like loginWithSMS or loginWithEmailOTP instead.', ); } diff --git a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithSmsWhitelabel.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithSmsWhitelabel.spec.ts index 0b1f3ebf4..fb228337c 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithSmsWhitelabel.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithSmsWhitelabel.spec.ts @@ -13,6 +13,7 @@ const expectedPhoneNumber = 'hey hey I am a number but jk'; test('Generates JSON RPC request payload with `phone` parameter', async () => { const magic = createMagicSDK(); magic.auth.request = jest.fn(); + magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); await magic.auth.loginWithSMS({ phoneNumber: expectedPhoneNumber, showUI: false }); @@ -24,6 +25,7 @@ test('Generates JSON RPC request payload with `phone` parameter', async () => { test('If `testMode` is enabled, testing-specific RPC method is used', async () => { const magic = createMagicSDKTestMode(); + magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); magic.auth.request = jest.fn(); await magic.auth.loginWithSMS({ phoneNumber: expectedPhoneNumber, showUI: false }); @@ -57,5 +59,7 @@ test('Generates JSON RPC pending for otp-input-sent', () => { test('method should return a PromiEvent', () => { const magic = createMagicSDK(); + magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + expect(isPromiEvent(magic.auth.loginWithSMS({ email: 'blag' }))).toBeTruthy(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/base-module/request.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/base-module/request.spec.ts index efc42bc10..e13207b1a 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/base-module/request.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/base-module/request.spec.ts @@ -79,7 +79,7 @@ test('Emits events received from the `ViewController`', done => { ), ); - baseModule.request(requestPayload).on('hello_a', result => { + baseModule.request(requestPayload).on('hello_a', (result: string) => { expect(result).toBe('world'); done(); }); @@ -98,7 +98,7 @@ test('Receive no further events after the response from `ViewController` resolve const response = new JsonRpcResponse(requestPayload).applyResult('hello world'); - const postStubPromises = []; + const postStubPromises: Promise[] = []; const { baseModule } = createBaseModule( jest.fn().mockImplementation(() => { const promise = new Promise(resolve => { @@ -113,7 +113,7 @@ test('Receive no further events after the response from `ViewController` resolve const request = baseModule .request(requestPayload) - .on('hello_b', result => { + .on('hello_b', (result:string) => { expect(result).toBe('world'); }) .on('hello_b2', () => { @@ -159,7 +159,7 @@ test('Falls back to empty array if `params` is missing from event', done => { ), ); - baseModule.request(requestPayload).on('hello_c', (...args) => { + baseModule.request(requestPayload).on('hello_c', (...args:[]) => { expect(args).toEqual([]); done(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/user/showSettings.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/user/showSettings.spec.ts index c75f8e929..a450fc435 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/user/showSettings.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/user/showSettings.spec.ts @@ -1,4 +1,6 @@ -import { DeepLinkPage } from '@magic-sdk/types/src/core/deep-link-pages'; +// import { DeepLinkPage } from '@magic-sdk/types/src/core/deep-link-pages'; +import { DeepLinkPage } from '../../../../../types/src/core/deep-link-pages'; + import { createMagicSDK, createMagicSDKTestMode } from '../../../factories'; import { isPromiEvent } from '../../../../src/util'; @@ -284,7 +286,7 @@ test('ShowSettings should handle request failure gracefully', () => { try { magic.user.showSettings(); } catch (error) { - expect(error.message).toBe('Request failed'); + expect((error as Error).message).toBe('Request failed'); } }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/wallet/connectWithUI.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/wallet/connectWithUI.spec.ts index 31af27071..858841280 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/wallet/connectWithUI.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/wallet/connectWithUI.spec.ts @@ -67,7 +67,7 @@ test('throws error auto-connecting if metamask browser', async () => { try { await magic.wallet.connectWithUI(); } catch (err) { - expect(err.message).toBe('Connection error'); + expect((err as Error).message).toBe('Connection error'); } }); @@ -109,6 +109,6 @@ test('throws error auto-connecting if coinbase wallet browser', async () => { try { await magic.wallet.connectWithUI(); } catch (err) { - expect(err.message).toBe('Connection error'); + expect((err as Error).message).toBe('Connection error'); } }); diff --git a/packages/@magic-sdk/provider/test/spec/util/device-share-web-crypto.spec.ts b/packages/@magic-sdk/provider/test/spec/util/device-share-web-crypto.spec.ts index e216358d3..927ac8b27 100644 --- a/packages/@magic-sdk/provider/test/spec/util/device-share-web-crypto.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/device-share-web-crypto.spec.ts @@ -21,12 +21,12 @@ const FAKE_ENCRYPTION_KEY = 'fake encryption key'; const FAKE_IV = new Uint8Array(JSON.parse('[24,252,88,58,36,159,217,125,152,115,39,254]')); beforeAll(() => { - jest.spyOn(storage, 'getItem').mockImplementation(async (key: string) => FAKE_STORE[key]); + jest.spyOn(storage, 'getItem').mockImplementation(async (key: string) => (FAKE_STORE as any)[key]); jest.spyOn(storage, 'setItem').mockImplementation(async (key: string, value: any) => { - FAKE_STORE[key] = value; + (FAKE_STORE as any)[key] = value; }); jest.spyOn(storage, 'removeItem').mockImplementation(async (key: string) => { - FAKE_STORE[key] = null; + (FAKE_STORE as any)[key] = null; }); jest.spyOn(storage, 'iterate').mockImplementation(async (callback) => { await callback('value1', `${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`, 1); @@ -53,14 +53,14 @@ test('encryptAndPersistDeviceShare should return undefined if webcrypto is unsup }); test('encryptAndPersistDeviceShare should return undefined if no device share found', async () => { - await encryptAndPersistDeviceShare(undefined, FAKE_NETWORK_HASH); + await encryptAndPersistDeviceShare(undefined as unknown as string, FAKE_NETWORK_HASH); expect(FAKE_STORE).toEqual({}); }); test('encryptAndPersistDeviceShare should persist encrypted device share when store doesnt have existing iv and encryption key', async () => { (window as any).crypto.subtle = { - generateKey: (input, extractable, scope) => Promise.resolve(FAKE_ENCRYPTION_KEY), - encrypt: (input) => Promise.resolve(base64ToArrayBuffer(FAKE_ENCRYPTED_DEVICE_SHARE)), + generateKey: () => Promise.resolve(FAKE_ENCRYPTION_KEY), + encrypt: () => Promise.resolve(base64ToArrayBuffer(FAKE_ENCRYPTED_DEVICE_SHARE)), }; await encryptAndPersistDeviceShare(FAKE_PLAINTEXT_SHARE, FAKE_NETWORK_HASH); @@ -69,11 +69,11 @@ test('encryptAndPersistDeviceShare should persist encrypted device share when st test('encryptAndPersistDeviceShare should persist encrypted device share when store has existing iv and encryption key', async () => { (window as any).crypto.subtle = { - encrypt: (input) => Promise.resolve(base64ToArrayBuffer(FAKE_ENCRYPTED_DEVICE_SHARE)), + encrypt: () => Promise.resolve(base64ToArrayBuffer(FAKE_ENCRYPTED_DEVICE_SHARE)), }; - FAKE_STORE[INITIALIZATION_VECTOR_KEY] = FAKE_IV; - FAKE_STORE[ENCRYPTION_KEY_KEY] = FAKE_ENCRYPTION_KEY; + (FAKE_STORE as any)[INITIALIZATION_VECTOR_KEY] = FAKE_IV; + (FAKE_STORE as any)[ENCRYPTION_KEY_KEY] = FAKE_ENCRYPTION_KEY; await encryptAndPersistDeviceShare(FAKE_PLAINTEXT_SHARE, FAKE_NETWORK_HASH); expect((FAKE_STORE as any).ds_network_hash).toEqual(FAKE_ENCRYPTED_DEVICE_SHARE); @@ -83,22 +83,22 @@ test('encryptAndPersistDeviceShare should persist encrypted device share when st test('getDecryptedDeviceShare should return undefined if no existing iv string found in storage', async () => { (window as any).crypto.subtle = { - decrypt: (input) => Promise.resolve(base64ToArrayBuffer(FAKE_ENCRYPTED_DEVICE_SHARE)), + decrypt: () => Promise.resolve(base64ToArrayBuffer(FAKE_ENCRYPTED_DEVICE_SHARE)), }; - FAKE_STORE[INITIALIZATION_VECTOR_KEY] = null; + (FAKE_STORE as any)[INITIALIZATION_VECTOR_KEY] = null; const res = await getDecryptedDeviceShare(FAKE_NETWORK_HASH); expect(res).toEqual(undefined); }); test('getDecryptedDeviceShare should return undefined if store has existing iv and ek but no device share', async () => { (window as any).crypto.subtle = { - decrypt: (input) => Promise.resolve(base64ToArrayBuffer(FAKE_DECRYPTED_DEVICE_SHARE)), + decrypt: () => Promise.resolve(base64ToArrayBuffer(FAKE_DECRYPTED_DEVICE_SHARE)), }; - FAKE_STORE[`${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`] = null; - FAKE_STORE[INITIALIZATION_VECTOR_KEY] = FAKE_IV; - FAKE_STORE[ENCRYPTION_KEY_KEY] = FAKE_ENCRYPTION_KEY; + (FAKE_STORE as any)[`${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`] = null; + (FAKE_STORE as any)[INITIALIZATION_VECTOR_KEY] = FAKE_IV; + (FAKE_STORE as any)[ENCRYPTION_KEY_KEY] = FAKE_ENCRYPTION_KEY; const res = await getDecryptedDeviceShare(FAKE_NETWORK_HASH); @@ -107,12 +107,12 @@ test('getDecryptedDeviceShare should return undefined if store has existing iv a test('getDecryptedDeviceShare returns decrypted device share if iv encryption key and device share are in storage', async () => { (window as any).crypto.subtle = { - decrypt: (input) => Promise.resolve(base64ToArrayBuffer(FAKE_DECRYPTED_DEVICE_SHARE)), + decrypt: () => Promise.resolve(base64ToArrayBuffer(FAKE_DECRYPTED_DEVICE_SHARE)), }; - FAKE_STORE[`${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`] = FAKE_ENCRYPTED_DEVICE_SHARE; - FAKE_STORE[INITIALIZATION_VECTOR_KEY] = FAKE_IV; - FAKE_STORE[ENCRYPTION_KEY_KEY] = FAKE_ENCRYPTION_KEY; + (FAKE_STORE as any)[`${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`] = FAKE_ENCRYPTED_DEVICE_SHARE; + (FAKE_STORE as any)[INITIALIZATION_VECTOR_KEY] = FAKE_IV; + (FAKE_STORE as any)[ENCRYPTION_KEY_KEY] = FAKE_ENCRYPTION_KEY; const res = await getDecryptedDeviceShare(FAKE_NETWORK_HASH); expect(res).toEqual(FAKE_DECRYPTED_DEVICE_SHARE); @@ -122,12 +122,12 @@ test('getDecryptedDeviceShare returns decrypted device share if iv encryption ke test('clearDeviceShares should successfully clear device shares', async () => { (window as any).crypto.subtle = { - decrypt: (input) => Promise.resolve(base64ToArrayBuffer(FAKE_DECRYPTED_DEVICE_SHARE)), + decrypt: () => Promise.resolve(base64ToArrayBuffer(FAKE_DECRYPTED_DEVICE_SHARE)), }; - FAKE_STORE[`${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`] = FAKE_ENCRYPTED_DEVICE_SHARE; + (FAKE_STORE as any)[`${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`] = FAKE_ENCRYPTED_DEVICE_SHARE; await clearDeviceShares(); - expect(FAKE_STORE[`${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`]).toEqual(null); + expect((FAKE_STORE as any)[`${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`]).toEqual(null); }); diff --git a/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts b/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts index 6cfb5d809..e135604c3 100644 --- a/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts @@ -1,7 +1,15 @@ import { createPromiEvent } from '../../../../src/util/promise-tools'; import { TypedEmitter } from '../../../../src/util/events'; -const chainingEmitterMethods = ['on', 'once', 'addListener', 'off', 'removeListener', 'removeAllListeners']; +type DefaultEvents = { + done: (result: TResult) => void; + error: (reason: any) => void; + settled: () => void; +}; + +type TypedEmitterMethods = keyof TypedEmitter>; + +const chainingEmitterMethods: TypedEmitterMethods[] = ['on', 'once', 'addListener', 'off', 'removeListener', 'removeAllListeners']; const nonChainingEmitterMethods = ['emit', 'eventNames', 'listeners', 'listenerCount']; const typedEmitterMethods = [...chainingEmitterMethods, ...nonChainingEmitterMethods]; const promiseMethods = ['then', 'catch', 'finally']; @@ -11,50 +19,50 @@ beforeEach(() => { }); test('Creates a native `Promise`', () => { - const p = createPromiEvent(resolve => resolve()); + const p = createPromiEvent(resolve => resolve(true)); expect(p instanceof Promise).toBe(true); }); test('Attaches `TypedEmitter` methods to the initial value', () => { - const p = createPromiEvent(resolve => resolve()); + const p = createPromiEvent(resolve => resolve(true)); typedEmitterMethods.forEach(method => { - expect(typeof p[method] === 'function').toBe(true); + expect(typeof p[method as keyof typeof p] === 'function').toBe(true); }); }); test('Attaches `TypedEmitter` methods to `Promise.then` result', () => { - const p = createPromiEvent(resolve => resolve()).then(); + const p = createPromiEvent(resolve => resolve(true)).then(); typedEmitterMethods.forEach(method => { - expect(typeof p[method] === 'function').toBe(true); + expect(typeof p[method as keyof typeof p] === 'function').toBe(true); }); }); test('Attaches `TypedEmitter` methods to `Promise.catch` result', () => { - const p = createPromiEvent(resolve => resolve()).catch(); + const p = createPromiEvent(resolve => resolve(true)).catch(); typedEmitterMethods.forEach(method => { - expect(typeof p[method] === 'function').toBe(true); + expect(typeof p[method as keyof typeof p] === 'function').toBe(true); }); }); test('Attaches `TypedEmitter` methods to `Promise.finally` result', () => { - const p = createPromiEvent(resolve => resolve()).catch(); + const p = createPromiEvent(resolve => resolve(true)).catch(); typedEmitterMethods.forEach(method => { - expect(typeof p[method] === 'function').toBe(true); + expect(typeof p[method as keyof typeof p] === 'function').toBe(true); }); }); test('Attaches `Promise` methods to `TypedEmitter` results', () => { chainingEmitterMethods.forEach(emitterMethod => { const emitterStub = jest.spyOn(TypedEmitter.prototype, emitterMethod as any).mockImplementation(); - const p = createPromiEvent(resolve => resolve())[emitterMethod](); + const p = createPromiEvent(resolve => resolve(true))[emitterMethod]('done', () => {}); promiseMethods.forEach(promiseMethod => { - expect(typeof p[promiseMethod] === 'function').toBe(true); + expect(typeof (p as any)[promiseMethod] === 'function').toBe(true); }); emitterStub.mockReset(); @@ -70,7 +78,7 @@ test('Emits "done" event upon Promise resolution', done => { }); test('Emits "settled" event upon Promise resolution', done => { - createPromiEvent(resolve => resolve()).on('settled', () => { + createPromiEvent(resolve => resolve(true)).on('settled', () => { done(); }); }); @@ -81,7 +89,7 @@ test('Emits "error" event upon Promise reject', done => { expect(err).toBe('goodbye' as any); done(); }) - .catch(() => {}); + .catch(() => { }); }); test('Emits "settled" event upon Promise reject', done => { @@ -89,5 +97,5 @@ test('Emits "settled" event upon Promise reject', done => { .on('settled', () => { done(); }) - .catch(() => {}); + .catch(() => { }); }); diff --git a/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromise.spec.ts b/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromise.spec.ts index f83267624..b443447fa 100644 --- a/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromise.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromise.spec.ts @@ -5,13 +5,13 @@ beforeEach(() => { }); test('Creates a native `Promise`', () => { - const p = createPromise(resolve => resolve()); + const p = createPromise(resolve => resolve(true)); expect(p instanceof Promise).toBe(true); }); test('Resolves the `Promise`', done => { - createPromise(resolve => resolve()).then(() => { + createPromise(resolve => resolve(true)).then(() => { done(); }); }); diff --git a/packages/@magic-sdk/provider/test/spec/util/promise-tools/isPromiEvent.spec.ts b/packages/@magic-sdk/provider/test/spec/util/promise-tools/isPromiEvent.spec.ts index b5b3c50bf..68736ed4a 100644 --- a/packages/@magic-sdk/provider/test/spec/util/promise-tools/isPromiEvent.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/promise-tools/isPromiEvent.spec.ts @@ -5,7 +5,7 @@ beforeEach(() => { }); test('Returns `true` for valid `PromiEvent` object', () => { - const p = createPromiEvent(resolve => resolve()); + const p = createPromiEvent(resolve => resolve(true)); expect(isPromiEvent(p)).toBe(true); }); diff --git a/packages/@magic-sdk/provider/test/spec/util/type-guards/isJsonRpcRequestPayload.spec.ts b/packages/@magic-sdk/provider/test/spec/util/type-guards/isJsonRpcRequestPayload.spec.ts index e09fe8966..98f4c990d 100644 --- a/packages/@magic-sdk/provider/test/spec/util/type-guards/isJsonRpcRequestPayload.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/type-guards/isJsonRpcRequestPayload.spec.ts @@ -5,7 +5,7 @@ test('Given `undefined`, returns false', async () => { }); test('Given `null`, returns false', async () => { - expect(isJsonRpcRequestPayload(null)).toBe(false); + expect(isJsonRpcRequestPayload(null as unknown as undefined)).toBe(false); }); test('Given without `JsonRpcRequestPayload.jsonrpc`, returns false', async () => { diff --git a/packages/@magic-sdk/provider/test/spec/util/web-crypto.spec.ts b/packages/@magic-sdk/provider/test/spec/util/web-crypto.spec.ts index e9761aa09..6edf8c434 100644 --- a/packages/@magic-sdk/provider/test/spec/util/web-crypto.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/web-crypto.spec.ts @@ -1,8 +1,9 @@ import { Crypto } from '@peculiar/webcrypto'; import * as storage from '../../../src/util/storage'; import { clearKeys, createJwt, STORE_KEY_PRIVATE_KEY, STORE_KEY_PUBLIC_JWK } from '../../../src/util/web-crypto'; +import { TextEncoder } from 'util'; -let FAKE_STORE = {}; +let FAKE_STORE: { [key: string]: any } = {}; beforeAll(() => { jest.spyOn(storage, 'getItem').mockImplementation(async (key: string) => FAKE_STORE[key]); @@ -12,10 +13,15 @@ beforeAll(() => { jest.spyOn(storage, 'removeItem').mockImplementation(async (key: string) => { FAKE_STORE[key] = null; }); + + Object.assign(global, { TextEncoder }); }); beforeEach(() => { - (window as any).crypto = new Crypto(); + Object.defineProperty(window, 'crypto', { + value: new Crypto, + writable: true, + }); }); afterEach(() => { @@ -39,7 +45,7 @@ test('should give undefined if missing private key', async () => { test('should return jwt if supported', async () => { const jwt = await createJwt(); expect(jwt).toBeTruthy(); - expect(jwt.split('.').length).toEqual(3); + expect(jwt?.split('.')?.length).toEqual(3); }); test('jwt is unique', async () => { From 9813571cc13f17bb91826df50be268a789dc350e Mon Sep 17 00:00:00 2001 From: sherzod-bakhodirov Date: Mon, 16 Dec 2024 15:29:58 +0500 Subject: [PATCH 06/13] fix: fix types in tests --- packages/@magic-ext/aptos/test/spec/aptos-extension.spec.ts | 5 +++++ packages/@magic-ext/kadena/test/spec/kadena.spec.ts | 2 +- packages/@magic-sdk/provider/test/factories.ts | 2 +- .../@magic-sdk/provider/test/spec/util/web-crypto.spec.ts | 2 +- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/@magic-ext/aptos/test/spec/aptos-extension.spec.ts b/packages/@magic-ext/aptos/test/spec/aptos-extension.spec.ts index dfe07a4a8..c736cf41e 100644 --- a/packages/@magic-ext/aptos/test/spec/aptos-extension.spec.ts +++ b/packages/@magic-ext/aptos/test/spec/aptos-extension.spec.ts @@ -2,6 +2,7 @@ import { BCS, TxnBuilderTypes } from 'aptos'; import { createMagicSDKWithExtension } from '../../../../@magic-sdk/provider/test/factories'; import { AptosExtension } from '../../src'; import { AptosPayloadMethod } from '../../src/type'; +import { TextEncoder, TextDecoder } from 'util'; const APTOS_NODE_URL = 'https://fullnode.testnet.aptoslabs.com'; @@ -30,6 +31,10 @@ const MESSAGE_PAYLOAD = { nonce: 'random-nonce', }; +beforeAll(() => { + Object.assign(global, { TextEncoder, TextDecoder }); +}) + beforeEach(() => { jest.resetAllMocks(); }); diff --git a/packages/@magic-ext/kadena/test/spec/kadena.spec.ts b/packages/@magic-ext/kadena/test/spec/kadena.spec.ts index ea1f7eaba..e89070942 100644 --- a/packages/@magic-ext/kadena/test/spec/kadena.spec.ts +++ b/packages/@magic-ext/kadena/test/spec/kadena.spec.ts @@ -23,6 +23,6 @@ test('Sends params as payload', () => { magic.kadena.signTransaction(params); const requestPayload = magic.kadena.request.mock.calls[0][0]; - expect(requestPayload.method).toBe(KadenaPayloadMethod.KadenaSignTransaction); + expect(requestPayload.method).toBe(KadenaPayloadMethod.KadenaSignTransaction as any); expect(requestPayload.params).toEqual([{ hash: '0x123' }]); }); diff --git a/packages/@magic-sdk/provider/test/factories.ts b/packages/@magic-sdk/provider/test/factories.ts index df1006c10..db9fb963a 100644 --- a/packages/@magic-sdk/provider/test/factories.ts +++ b/packages/@magic-sdk/provider/test/factories.ts @@ -67,7 +67,7 @@ export function createMagicSDKTestMode(environment: { [P in keyof SDKEnvironment return new Ctor(TEST_API_KEY, { testMode: true }); } -export function createMagicSDKWithExtension(environment: { [P in keyof SDKEnvironment]?: any } = {}, extensions = []) { +export function createMagicSDKWithExtension(environment: { [P in keyof SDKEnvironment]?: any } = {}, extensions:any[] = []) { const Ctor = createMagicSDKCtor(environment); return new Ctor(TEST_API_KEY, { extensions }); } diff --git a/packages/@magic-sdk/provider/test/spec/util/web-crypto.spec.ts b/packages/@magic-sdk/provider/test/spec/util/web-crypto.spec.ts index 6edf8c434..7e6bde77a 100644 --- a/packages/@magic-sdk/provider/test/spec/util/web-crypto.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/web-crypto.spec.ts @@ -63,7 +63,7 @@ test('should store public and private keys after creating JWT', async () => { test('private key should be non exportable', async () => { await createJwt(); const privateKey = FAKE_STORE[STORE_KEY_PRIVATE_KEY]; - expect(() => crypto.subtle.exportKey('jwk', privateKey)).toThrow(); + expect(() => crypto.subtle.exportKey('jwk', privateKey)).rejects.toThrow(); }); test('when asked should clear keys', async () => { From 612f130cf5b71c4623d691f5519f898e2d88601f Mon Sep 17 00:00:00 2001 From: sherzod-bakhodirov Date: Mon, 16 Dec 2024 15:58:31 +0500 Subject: [PATCH 07/13] fix: kadena tests --- packages/@magic-ext/kadena/test/spec/kadena.spec.ts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/packages/@magic-ext/kadena/test/spec/kadena.spec.ts b/packages/@magic-ext/kadena/test/spec/kadena.spec.ts index 1c1def1ae..991611a0e 100644 --- a/packages/@magic-ext/kadena/test/spec/kadena.spec.ts +++ b/packages/@magic-ext/kadena/test/spec/kadena.spec.ts @@ -12,7 +12,6 @@ test('signTransaction - Sends params as payload', () => { rpcUrl: '', chainId: '1', networkId: 'testnet04', - network: 'testnet', createAccountsOnChain: true, }), ]); @@ -33,7 +32,6 @@ test('signTransactionWithSpireKey - Sends params as payload', () => { rpcUrl: '', chainId: '1', networkId: 'testnet04', - network: 'testnet', createAccountsOnChain: true, }), ]); @@ -58,7 +56,6 @@ test('Generate JSON RPC request payload with method `kda_loginWithSpireKey`', () rpcUrl: '', chainId: '1', networkId: 'testnet04', - network: 'testnet', createAccountsOnChain: true, }), ]); @@ -76,7 +73,6 @@ test('Generate JSON RPC request payload with method `kda_getUserInfo`', () => { rpcUrl: '', chainId: '1', networkId: 'testnet04', - network: 'testnet', createAccountsOnChain: true, }), ]); From a255c10f3f29029f964806061e4c4ff444007085 Mon Sep 17 00:00:00 2001 From: sherzod-bakhodirov Date: Mon, 16 Dec 2024 18:55:13 +0500 Subject: [PATCH 08/13] fix: deepsource 'any' --- .../kadena/test/spec/kadena.spec.ts | 2 +- .../@magic-sdk/provider/test/factories.ts | 2 +- packages/@magic-sdk/provider/test/mocks.ts | 2 +- .../spec/core/view-controller/post.spec.ts | 6 ++-- .../modules/auth/loginWithCredential.spec.ts | 4 +-- .../spec/util/device-share-web-crypto.spec.ts | 32 +++++++++---------- .../promise-tools/createPromiEvent.spec.ts | 4 +-- .../test/spec/util/web-crypto.spec.ts | 2 +- .../test/spec/iframe-controller/init.spec.ts | 12 +++---- .../iframe-controller/showOverlay.spec.ts | 5 +-- 10 files changed, 36 insertions(+), 35 deletions(-) diff --git a/packages/@magic-ext/kadena/test/spec/kadena.spec.ts b/packages/@magic-ext/kadena/test/spec/kadena.spec.ts index 991611a0e..c35ef265b 100644 --- a/packages/@magic-ext/kadena/test/spec/kadena.spec.ts +++ b/packages/@magic-ext/kadena/test/spec/kadena.spec.ts @@ -22,7 +22,7 @@ test('signTransaction - Sends params as payload', () => { magic.kadena.signTransaction(params); const requestPayload = magic.kadena.request.mock.calls[0][0]; - expect(requestPayload.method).toBe(KadenaPayloadMethod.KadenaSignTransaction as any); + expect(requestPayload.method).toBe(KadenaPayloadMethod.KadenaSignTransaction); expect(requestPayload.params).toEqual([{ hash: '0x123' }]); }); diff --git a/packages/@magic-sdk/provider/test/factories.ts b/packages/@magic-sdk/provider/test/factories.ts index db9fb963a..9ab33a55b 100644 --- a/packages/@magic-sdk/provider/test/factories.ts +++ b/packages/@magic-sdk/provider/test/factories.ts @@ -67,7 +67,7 @@ export function createMagicSDKTestMode(environment: { [P in keyof SDKEnvironment return new Ctor(TEST_API_KEY, { testMode: true }); } -export function createMagicSDKWithExtension(environment: { [P in keyof SDKEnvironment]?: any } = {}, extensions:any[] = []) { +export function createMagicSDKWithExtension(environment: { [P in keyof SDKEnvironment]?: any } = {}, extensions:unknown[] = []) { const Ctor = createMagicSDKCtor(environment); return new Ctor(TEST_API_KEY, { extensions }); } diff --git a/packages/@magic-sdk/provider/test/mocks.ts b/packages/@magic-sdk/provider/test/mocks.ts index 4477964f4..66ef3ee82 100644 --- a/packages/@magic-sdk/provider/test/mocks.ts +++ b/packages/@magic-sdk/provider/test/mocks.ts @@ -25,7 +25,7 @@ export function restoreSDKEnvironmentConstants() { jest.unmock('../src/core/sdk-environment'); } -export function mockLocalForage(FAKE_STORE: { [key: string]: any } = {}) { +export function mockLocalForage(FAKE_STORE: Record = {}) { jest.spyOn(storage, 'getItem').mockImplementation((key: string) => FAKE_STORE[key]); jest.spyOn(storage, 'setItem').mockImplementation(async (key: string, value: any) => { FAKE_STORE[key] = value; diff --git a/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts b/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts index fa691d3e2..9f0e4fcda 100644 --- a/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts @@ -61,14 +61,14 @@ function stubViewController(viewController: any, events: [MagicIncomingWindowMes return { handlerSpy, onSpy, postSpy }; } -let createJwtStub: jest.SpyInstance, [], any>; +let createJwtStub: jest.SpyInstance>; let getDecryptedDeviceShareStub: jest.SpyInstance>;; -let clearDeviceSharesStub: jest.SpyInstance, [], any>; +let clearDeviceSharesStub: jest.SpyInstance>; const FAKE_JWT_TOKEN = 'hot tokens'; const FAKE_DEVICE_SHARE = 'fake device share'; const FAKE_RT = 'will freshen'; const FAKE_INJECTED_JWT = 'fake injected jwt'; -let FAKE_STORE: {[key: string]: any} = {}; +let FAKE_STORE: Record = {}; let viewController: TestViewController; diff --git a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithCredential.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithCredential.spec.ts index ab29d6fbe..8131c6c6e 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithCredential.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithCredential.spec.ts @@ -24,13 +24,13 @@ test('If no parameters are given & platform target is "web", URL search string a const magic = createMagicSDK({ platform: 'web' }); magic.auth.request = jest.fn(); - jest.spyOn(window.history, 'replaceState').mockImplementation(() => {}); + jest.spyOn(window.history, 'replaceState').mockImplementation(() => { }); jest.spyOn(window, 'location', 'get').mockReturnValue({ search: '?magic_credential=asdf', origin: 'http://example.com', pathname: '/hello/world', - } as any); + } as unknown as Location); await magic.auth.loginWithCredential(); diff --git a/packages/@magic-sdk/provider/test/spec/util/device-share-web-crypto.spec.ts b/packages/@magic-sdk/provider/test/spec/util/device-share-web-crypto.spec.ts index 927ac8b27..2d24b1205 100644 --- a/packages/@magic-sdk/provider/test/spec/util/device-share-web-crypto.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/device-share-web-crypto.spec.ts @@ -10,7 +10,7 @@ import { getDecryptedDeviceShare, } from '../../../src/util/device-share-web-crypto'; -let FAKE_STORE = {}; +let FAKE_STORE: Record = {}; const FAKE_NETWORK_HASH = 'network_hash'; const FAKE_PLAINTEXT_SHARE = `AQICAHg1y7j1UY7sfTib6h9cN2Kh7v0WhCRwQxEPhGAQ2m5OgQGrJvUP6MKiuj9yD96y6B4eAAABPzCCATsGCSqGSIb3DQEHBqCCASwwggEoAgEAMIIBIQYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAy6tbGg/6//2IJs9xUCARCAgfOY3knm1i2kGjLXQFoqEjOeLr/UGwHQ+AW1y20UoCX3ght68egu06Hg54JF/mCGgSDt7R7dFSOuGvapE9OEyFYz4f1+tpWb5PPaLReBRTTTfw/8Xgsfzl6iXACsLKqyXEeWci+/vOWDLqu73E0uy5StyN5InZLwHCJe4l+KMEr5C7JZvobQh4NVBT5SqgQXmLGXGGH/2ydkq8zkgVGDT9jQlqqpUH83UMFQwHSwbJRRyYLxBwQKTO0AODfqk5OnWRA+BoDC8HMFyQUb4nS+BgDlgTgL7Kg/H/Echr+SlQKJdWJnvf3BjSBwO8z5kVpxRo5xwG4=`; @@ -21,12 +21,12 @@ const FAKE_ENCRYPTION_KEY = 'fake encryption key'; const FAKE_IV = new Uint8Array(JSON.parse('[24,252,88,58,36,159,217,125,152,115,39,254]')); beforeAll(() => { - jest.spyOn(storage, 'getItem').mockImplementation(async (key: string) => (FAKE_STORE as any)[key]); + jest.spyOn(storage, 'getItem').mockImplementation(async (key: string) => FAKE_STORE[key]); jest.spyOn(storage, 'setItem').mockImplementation(async (key: string, value: any) => { - (FAKE_STORE as any)[key] = value; + FAKE_STORE[key] = value; }); jest.spyOn(storage, 'removeItem').mockImplementation(async (key: string) => { - (FAKE_STORE as any)[key] = null; + FAKE_STORE[key] = null; }); jest.spyOn(storage, 'iterate').mockImplementation(async (callback) => { await callback('value1', `${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`, 1); @@ -64,7 +64,7 @@ test('encryptAndPersistDeviceShare should persist encrypted device share when st }; await encryptAndPersistDeviceShare(FAKE_PLAINTEXT_SHARE, FAKE_NETWORK_HASH); - expect((FAKE_STORE as any).ds_network_hash).toEqual(FAKE_ENCRYPTED_DEVICE_SHARE); + expect(FAKE_STORE.ds_network_hash).toEqual(FAKE_ENCRYPTED_DEVICE_SHARE); }); test('encryptAndPersistDeviceShare should persist encrypted device share when store has existing iv and encryption key', async () => { @@ -72,8 +72,8 @@ test('encryptAndPersistDeviceShare should persist encrypted device share when st encrypt: () => Promise.resolve(base64ToArrayBuffer(FAKE_ENCRYPTED_DEVICE_SHARE)), }; - (FAKE_STORE as any)[INITIALIZATION_VECTOR_KEY] = FAKE_IV; - (FAKE_STORE as any)[ENCRYPTION_KEY_KEY] = FAKE_ENCRYPTION_KEY; + FAKE_STORE[INITIALIZATION_VECTOR_KEY] = FAKE_IV; + FAKE_STORE[ENCRYPTION_KEY_KEY] = FAKE_ENCRYPTION_KEY; await encryptAndPersistDeviceShare(FAKE_PLAINTEXT_SHARE, FAKE_NETWORK_HASH); expect((FAKE_STORE as any).ds_network_hash).toEqual(FAKE_ENCRYPTED_DEVICE_SHARE); @@ -86,7 +86,7 @@ test('getDecryptedDeviceShare should return undefined if no existing iv string f decrypt: () => Promise.resolve(base64ToArrayBuffer(FAKE_ENCRYPTED_DEVICE_SHARE)), }; - (FAKE_STORE as any)[INITIALIZATION_VECTOR_KEY] = null; + FAKE_STORE[INITIALIZATION_VECTOR_KEY] = null; const res = await getDecryptedDeviceShare(FAKE_NETWORK_HASH); expect(res).toEqual(undefined); }); @@ -96,9 +96,9 @@ test('getDecryptedDeviceShare should return undefined if store has existing iv a decrypt: () => Promise.resolve(base64ToArrayBuffer(FAKE_DECRYPTED_DEVICE_SHARE)), }; - (FAKE_STORE as any)[`${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`] = null; - (FAKE_STORE as any)[INITIALIZATION_VECTOR_KEY] = FAKE_IV; - (FAKE_STORE as any)[ENCRYPTION_KEY_KEY] = FAKE_ENCRYPTION_KEY; + FAKE_STORE[`${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`] = null; + FAKE_STORE[INITIALIZATION_VECTOR_KEY] = FAKE_IV; + FAKE_STORE[ENCRYPTION_KEY_KEY] = FAKE_ENCRYPTION_KEY; const res = await getDecryptedDeviceShare(FAKE_NETWORK_HASH); @@ -110,9 +110,9 @@ test('getDecryptedDeviceShare returns decrypted device share if iv encryption ke decrypt: () => Promise.resolve(base64ToArrayBuffer(FAKE_DECRYPTED_DEVICE_SHARE)), }; - (FAKE_STORE as any)[`${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`] = FAKE_ENCRYPTED_DEVICE_SHARE; - (FAKE_STORE as any)[INITIALIZATION_VECTOR_KEY] = FAKE_IV; - (FAKE_STORE as any)[ENCRYPTION_KEY_KEY] = FAKE_ENCRYPTION_KEY; + FAKE_STORE[`${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`] = FAKE_ENCRYPTED_DEVICE_SHARE; + FAKE_STORE[INITIALIZATION_VECTOR_KEY] = FAKE_IV; + FAKE_STORE[ENCRYPTION_KEY_KEY] = FAKE_ENCRYPTION_KEY; const res = await getDecryptedDeviceShare(FAKE_NETWORK_HASH); expect(res).toEqual(FAKE_DECRYPTED_DEVICE_SHARE); @@ -125,9 +125,9 @@ test('clearDeviceShares should successfully clear device shares', async () => { decrypt: () => Promise.resolve(base64ToArrayBuffer(FAKE_DECRYPTED_DEVICE_SHARE)), }; - (FAKE_STORE as any)[`${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`] = FAKE_ENCRYPTED_DEVICE_SHARE; + FAKE_STORE[`${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`] = FAKE_ENCRYPTED_DEVICE_SHARE; await clearDeviceShares(); - expect((FAKE_STORE as any)[`${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`]).toEqual(null); + expect(FAKE_STORE[`${DEVICE_SHARE_KEY}_${FAKE_NETWORK_HASH}`]).toEqual(null); }); diff --git a/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts b/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts index e135604c3..804d20482 100644 --- a/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts @@ -3,7 +3,7 @@ import { TypedEmitter } from '../../../../src/util/events'; type DefaultEvents = { done: (result: TResult) => void; - error: (reason: any) => void; + error: (reason: unknown) => void; settled: () => void; }; @@ -62,7 +62,7 @@ test('Attaches `Promise` methods to `TypedEmitter` results', () => { const p = createPromiEvent(resolve => resolve(true))[emitterMethod]('done', () => {}); promiseMethods.forEach(promiseMethod => { - expect(typeof (p as any)[promiseMethod] === 'function').toBe(true); + expect(typeof (p as Record)[promiseMethod] === 'function').toBe(true); }); emitterStub.mockReset(); diff --git a/packages/@magic-sdk/provider/test/spec/util/web-crypto.spec.ts b/packages/@magic-sdk/provider/test/spec/util/web-crypto.spec.ts index 7e6bde77a..4ee8ff20f 100644 --- a/packages/@magic-sdk/provider/test/spec/util/web-crypto.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/web-crypto.spec.ts @@ -3,7 +3,7 @@ import * as storage from '../../../src/util/storage'; import { clearKeys, createJwt, STORE_KEY_PRIVATE_KEY, STORE_KEY_PUBLIC_JWK } from '../../../src/util/web-crypto'; import { TextEncoder } from 'util'; -let FAKE_STORE: { [key: string]: any } = {}; +let FAKE_STORE: Record = {}; beforeAll(() => { jest.spyOn(storage, 'getItem').mockImplementation(async (key: string) => FAKE_STORE[key]); diff --git a/packages/magic-sdk/test/spec/iframe-controller/init.spec.ts b/packages/magic-sdk/test/spec/iframe-controller/init.spec.ts index 1fe86e2bf..7ad91017b 100644 --- a/packages/magic-sdk/test/spec/iframe-controller/init.spec.ts +++ b/packages/magic-sdk/test/spec/iframe-controller/init.spec.ts @@ -42,7 +42,7 @@ test('Appends header with style, appends body with iframe, and resolves iframe', jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); jest.spyOn(global, 'removeEventListener').mockImplementation(jest.fn()); - jest.spyOn(document, 'querySelectorAll').mockReturnValue({ length: 0 } as any); + jest.spyOn(document, 'querySelectorAll').mockReturnValue({ length: 0 } as unknown as NodeListOf); jest.spyOn(document, 'createElement').mockImplementation(createElementStub); jest.spyOn(document, 'readyState', 'get').mockReturnValue('complete'); jest.spyOn(document.body, 'appendChild').mockImplementation(appendChildStub); @@ -64,7 +64,7 @@ test('Displays warning in console upon duplicate iframes', async () => { jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); jest.spyOn(global, 'removeEventListener').mockImplementation(jest.fn()); - jest.spyOn(document, 'querySelectorAll').mockReturnValue([{ src: ENCODED_QUERY_PARAMS }] as any); + jest.spyOn(document, 'querySelectorAll').mockReturnValue([{ src: ENCODED_QUERY_PARAMS }] as unknown as NodeListOf); jest.spyOn(document, 'createElement').mockImplementation(createElementStub); jest.spyOn(document, 'readyState', 'get').mockReturnValue('complete'); jest.spyOn(document.body, 'appendChild').mockImplementation(appendChildStub); @@ -81,7 +81,7 @@ test('Waits until `document` is loaded/ready', async () => { jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); jest.spyOn(global, 'removeEventListener').mockImplementation(jest.fn()); - jest.spyOn(document, 'querySelectorAll').mockReturnValue({ length: 0 } as any); + jest.spyOn(document, 'querySelectorAll').mockReturnValue({ length: 0 } as unknown as NodeListOf); jest.spyOn(document, 'createElement').mockImplementation(createElementStub); jest.spyOn(document, 'readyState', 'get').mockReturnValue('loading'); jest.spyOn(document.body, 'appendChild').mockImplementation(appendChildStub); @@ -97,7 +97,7 @@ test('Assumes the iframe is not yet initialized if `src` is `undefined`', async jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); jest.spyOn(global, 'removeEventListener').mockImplementation(jest.fn()); - jest.spyOn(document, 'querySelectorAll').mockReturnValue({ length: 0 } as any); + jest.spyOn(document, 'querySelectorAll').mockReturnValue({ length: 0 } as unknown as NodeListOf); jest.spyOn(document, 'createElement').mockImplementation(createElementStub); jest.spyOn(document, 'readyState', 'get').mockReturnValue('complete'); jest.spyOn(document.body, 'appendChild').mockImplementation(appendChildStub); @@ -187,7 +187,7 @@ test('Executes events where `messageHandlers` size is > 0', done => { }); test('Ignores events where `messageHandlers` size is === 0', done => { - jest.spyOn(global, 'location', 'get').mockImplementation(() => new URL(MAGIC_RELAYER_FULL_URL) as any); + jest.spyOn(global, 'location', 'get').mockImplementation(() => new URL(MAGIC_RELAYER_FULL_URL) as unknown as Location); const viewController = createIframeController(); (viewController as any).endpoint = ''; // Force `event.origin` and `this.endpoint` to be equivalent @@ -201,7 +201,7 @@ test('Ignores events where `messageHandlers` size is === 0', done => { }); test('Ignores events where `event.origin` and `this.endpoint` are not equivalent', done => { - jest.spyOn(global, 'location', 'get').mockImplementation(() => new URL(MAGIC_RELAYER_FULL_URL) as any); + jest.spyOn(global, 'location', 'get').mockImplementation(() => new URL(MAGIC_RELAYER_FULL_URL) as unknown as Location); const viewController = createIframeController(); (viewController as any).messageHandlers = { size: 0 }; diff --git a/packages/magic-sdk/test/spec/iframe-controller/showOverlay.spec.ts b/packages/magic-sdk/test/spec/iframe-controller/showOverlay.spec.ts index a743ce49c..afde43a3f 100644 --- a/packages/magic-sdk/test/spec/iframe-controller/showOverlay.spec.ts +++ b/packages/magic-sdk/test/spec/iframe-controller/showOverlay.spec.ts @@ -54,12 +54,13 @@ test('Saves the current `document.activeElement`', async () => { }; const overlay = createIframeController(); + const mockElement = document.createElement('div'); - jest.spyOn(document, 'activeElement', 'get').mockReturnValue('qwertyqwerty' as any); + jest.spyOn(document, 'activeElement', 'get').mockReturnValue(mockElement); expect((overlay as any).activeElement).toBe(null); await (overlay as any).showOverlay(); - expect((overlay as any).activeElement).toBe('qwertyqwerty'); + expect((overlay as any).activeElement).toBe(mockElement); }); From 7ed6806cfd24b529da5679395116a3e60f3f0fed Mon Sep 17 00:00:00 2001 From: sherzod-bakhodirov Date: Tue, 17 Dec 2024 17:07:32 +0500 Subject: [PATCH 09/13] fix: deepsourse --- packages/@magic-sdk/provider/test/mocks.ts | 12 +++++-- .../magic-rpc-error/constructor.spec.ts | 3 +- .../spec/core/view-controller/post.spec.ts | 16 ++++++--- .../modules/auth/loginWithCredential.spec.ts | 2 +- .../auth/loginWithEmailOTPWhitelabel.spec.ts | 8 ++--- .../auth/loginWithSmsWhitelabel.spec.ts | 8 ++--- .../auth/updateEmailWithUI.whitelabel.spec.ts | 8 ++--- .../spec/modules/base-module/request.spec.ts | 6 ++-- .../spec/modules/user/recoverAccount.spec.ts | 14 ++++---- .../spec/util/device-share-web-crypto.spec.ts | 2 +- .../promise-tools/createPromiEvent.spec.ts | 34 +++++++++++-------- .../util/promise-tools/createPromise.spec.ts | 4 +-- .../util/promise-tools/isPromiEvent.spec.ts | 8 ++--- .../test/spec/util/web-crypto.spec.ts | 4 +-- 14 files changed, 74 insertions(+), 55 deletions(-) diff --git a/packages/@magic-sdk/provider/test/mocks.ts b/packages/@magic-sdk/provider/test/mocks.ts index 66ef3ee82..499e986f9 100644 --- a/packages/@magic-sdk/provider/test/mocks.ts +++ b/packages/@magic-sdk/provider/test/mocks.ts @@ -25,8 +25,16 @@ export function restoreSDKEnvironmentConstants() { jest.unmock('../src/core/sdk-environment'); } -export function mockLocalForage(FAKE_STORE: Record = {}) { - jest.spyOn(storage, 'getItem').mockImplementation((key: string) => FAKE_STORE[key]); +export function mockLocalForage(FAKE_STORE: Record = {}) { + jest.spyOn(storage, 'getItem').mockImplementation((key: string, callback?: (err: unknown, value: unknown) => void) => { + const value = FAKE_STORE[key]; + + if (callback) { + callback(null, value); + } + + return Promise.resolve(value); + }); jest.spyOn(storage, 'setItem').mockImplementation(async (key: string, value: any) => { FAKE_STORE[key] = value; }); diff --git a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-rpc-error/constructor.spec.ts b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-rpc-error/constructor.spec.ts index 8c5970eaa..f36f2e0ec 100644 --- a/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-rpc-error/constructor.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/sdk-exceptions/magic-rpc-error/constructor.spec.ts @@ -43,8 +43,7 @@ test('Initialize MagicRPCError with `undefined` argument', () => { test('Initialize MagicRPCError with unknown error code argument', () => { const err = new MagicRPCError({ - // @ts-ignore - code: 1, + code: -32603, message: 'hello world', data: exampleData, }); diff --git a/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts b/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts index 9f0e4fcda..51244a233 100644 --- a/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts @@ -68,7 +68,7 @@ const FAKE_JWT_TOKEN = 'hot tokens'; const FAKE_DEVICE_SHARE = 'fake device share'; const FAKE_RT = 'will freshen'; const FAKE_INJECTED_JWT = 'fake injected jwt'; -let FAKE_STORE: Record = {}; +let FAKE_STORE: Record = {}; let viewController: TestViewController; @@ -78,9 +78,17 @@ beforeEach(() => { createJwtStub = jest.spyOn(webCryptoUtils, 'createJwt'); getDecryptedDeviceShareStub = jest.spyOn(deviceShareWebCryptoUtils, 'getDecryptedDeviceShare'); clearDeviceSharesStub = jest.spyOn(deviceShareWebCryptoUtils, 'clearDeviceShares'); - jest.spyOn(global.console, 'info').mockImplementation(() => {}); + jest.spyOn(global.console, 'info').mockImplementation(() => { }); jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); - jest.spyOn(storage, 'getItem').mockImplementation((key: string) => FAKE_STORE[key]); + jest.spyOn(storage, 'getItem').mockImplementation((key: string, callback?: (err: unknown, value: unknown) => void) => { + const value = FAKE_STORE[key]; + + if (callback) { + callback(null, value); + } + + return Promise.resolve(value); + }); jest.spyOn(storage, 'setItem').mockImplementation(async (key: string, value: any) => { FAKE_STORE[key] = value; }); @@ -205,7 +213,7 @@ test('Sends payload without rt if no jwt can be made', async () => { }); test('Sends payload when web crypto jwt fails', async () => { - const consoleErrorStub = jest.spyOn(global.console, 'error').mockImplementationOnce(() => {}); + const consoleErrorStub = jest.spyOn(global.console, 'error').mockImplementationOnce(() => { }); createJwtStub.mockRejectedValueOnce('danger'); FAKE_STORE.rt = FAKE_RT; diff --git a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithCredential.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithCredential.spec.ts index 8131c6c6e..608c68e42 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithCredential.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithCredential.spec.ts @@ -24,7 +24,7 @@ test('If no parameters are given & platform target is "web", URL search string a const magic = createMagicSDK({ platform: 'web' }); magic.auth.request = jest.fn(); - jest.spyOn(window.history, 'replaceState').mockImplementation(() => { }); + jest.spyOn(window.history, 'replaceState').mockImplementation(() => { /* noop */ }); jest.spyOn(window, 'location', 'get').mockReturnValue({ search: '?magic_credential=asdf', diff --git a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithEmailOTPWhitelabel.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithEmailOTPWhitelabel.spec.ts index 5f169558c..59de4a278 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithEmailOTPWhitelabel.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithEmailOTPWhitelabel.spec.ts @@ -9,7 +9,7 @@ const expectedEmail = 'john.doe@mail.com'; test('Generates JSON RPC pending for otp-input-sent', async () => { const magic = createMagicSDK(); - magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); const createIntermediaryEventFn = jest.fn(); magic.auth.createIntermediaryEvent = jest.fn().mockImplementation(() => createIntermediaryEventFn); @@ -29,7 +29,7 @@ test('Generates JSON RPC pending for otp-input-sent', async () => { test('Generates JSON RPC pending for verify-mfa-code', () => { const magic = createMagicSDK(); - magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); const createIntermediaryEventFn = jest.fn(); magic.auth.createIntermediaryEvent = jest.fn().mockImplementation(() => createIntermediaryEventFn); @@ -49,7 +49,7 @@ test('Generates JSON RPC pending for verify-mfa-code', () => { test('Generates JSON RPC pending for lost-device', () => { const magic = createMagicSDK(); - magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); const createIntermediaryEventFn = jest.fn(); magic.auth.createIntermediaryEvent = jest.fn().mockImplementation(() => createIntermediaryEventFn); @@ -67,7 +67,7 @@ test('Generates JSON RPC pending for lost-device', () => { test('Generates JSON RPC pending for verify-recovery-code', () => { const magic = createMagicSDK(); - magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); const createIntermediaryEventFn = jest.fn(); magic.auth.createIntermediaryEvent = jest.fn().mockImplementation(() => createIntermediaryEventFn); diff --git a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithSmsWhitelabel.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithSmsWhitelabel.spec.ts index fb228337c..718f3a749 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithSmsWhitelabel.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/auth/loginWithSmsWhitelabel.spec.ts @@ -13,7 +13,7 @@ const expectedPhoneNumber = 'hey hey I am a number but jk'; test('Generates JSON RPC request payload with `phone` parameter', async () => { const magic = createMagicSDK(); magic.auth.request = jest.fn(); - magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); await magic.auth.loginWithSMS({ phoneNumber: expectedPhoneNumber, showUI: false }); @@ -25,7 +25,7 @@ test('Generates JSON RPC request payload with `phone` parameter', async () => { test('If `testMode` is enabled, testing-specific RPC method is used', async () => { const magic = createMagicSDKTestMode(); - magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); magic.auth.request = jest.fn(); await magic.auth.loginWithSMS({ phoneNumber: expectedPhoneNumber, showUI: false }); @@ -39,7 +39,7 @@ test('If `testMode` is enabled, testing-specific RPC method is used', async () = test('Generates JSON RPC pending for otp-input-sent', () => { const magic = createMagicSDK(); - magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); const createIntermediaryEventFn = jest.fn(); magic.auth.createIntermediaryEvent = jest.fn().mockImplementation(() => createIntermediaryEventFn); @@ -59,7 +59,7 @@ test('Generates JSON RPC pending for otp-input-sent', () => { test('method should return a PromiEvent', () => { const magic = createMagicSDK(); - magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); expect(isPromiEvent(magic.auth.loginWithSMS({ email: 'blag' }))).toBeTruthy(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/auth/updateEmailWithUI.whitelabel.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/auth/updateEmailWithUI.whitelabel.spec.ts index e8e7af216..1b86dd0c7 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/auth/updateEmailWithUI.whitelabel.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/auth/updateEmailWithUI.whitelabel.spec.ts @@ -7,7 +7,7 @@ beforeEach(() => { test('Generate JSON RPC request payload with method `magic_auth_update_email` whitelabel and start recency check', async () => { const magic = createMagicSDK(); - magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); const createIntermediaryEventFn = jest.fn(); magic.auth.createIntermediaryEvent = jest.fn().mockImplementation(() => createIntermediaryEventFn); @@ -27,7 +27,7 @@ test('Generate JSON RPC request payload with method `magic_auth_update_email` wh test('Whitelabel `magic_auth_update_email`, recency check Retry event', async () => { const magic = createMagicSDK(); - magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); const createIntermediaryEventFn = jest.fn(); magic.auth.createIntermediaryEvent = jest.fn().mockImplementation(() => createIntermediaryEventFn); @@ -41,7 +41,7 @@ test('Whitelabel `magic_auth_update_email`, recency check Retry event', async () test('Whitelabel `magic_auth_update_email`, Update Email, fire retry with Email event', async () => { const magic = createMagicSDK(); - magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); const createIntermediaryEventFn = jest.fn(); magic.auth.createIntermediaryEvent = jest.fn().mockImplementation(() => createIntermediaryEventFn); @@ -58,7 +58,7 @@ test('Whitelabel `magic_auth_update_email`, Update Email, fire retry with Email test('Generate JSON RPC request payload with method `magic_auth_update_email` whitelabel and start verify Email otp ', async () => { const magic = createMagicSDK(); - magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.auth.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); const createIntermediaryEventFn = jest.fn(); magic.auth.createIntermediaryEvent = jest.fn().mockImplementation(() => createIntermediaryEventFn); diff --git a/packages/@magic-sdk/provider/test/spec/modules/base-module/request.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/base-module/request.spec.ts index e13207b1a..1c02d7e4c 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/base-module/request.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/base-module/request.spec.ts @@ -30,7 +30,7 @@ const requestPayload: JsonRpcRequestPayload = { beforeEach(() => { jest.restoreAllMocks(); // Silence the "duplicate iframes" warning. - jest.spyOn(console, 'warn').mockImplementation(() => {}); + jest.spyOn(console, 'warn').mockImplementation(() => { /* noop */ }); }); test('Resolves with a successful response', async () => { @@ -113,7 +113,7 @@ test('Receive no further events after the response from `ViewController` resolve const request = baseModule .request(requestPayload) - .on('hello_b', (result:string) => { + .on('hello_b', (result: string) => { expect(result).toBe('world'); }) .on('hello_b2', () => { @@ -159,7 +159,7 @@ test('Falls back to empty array if `params` is missing from event', done => { ), ); - baseModule.request(requestPayload).on('hello_c', (...args:[]) => { + baseModule.request(requestPayload).on('hello_c', (...args: []) => { expect(args).toEqual([]); done(); }); diff --git a/packages/@magic-sdk/provider/test/spec/modules/user/recoverAccount.spec.ts b/packages/@magic-sdk/provider/test/spec/modules/user/recoverAccount.spec.ts index 82ac7d0ac..899cebc2d 100644 --- a/packages/@magic-sdk/provider/test/spec/modules/user/recoverAccount.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/modules/user/recoverAccount.spec.ts @@ -36,7 +36,7 @@ test('method should return a PromiEvent', () => { test('method should create intermediary event on cancel', () => { const magic = createMagicSDK(); - magic.user.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.user.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); const createIntermediaryEventFn = jest.fn(); magic.user.createIntermediaryEvent = jest.fn().mockImplementation(() => createIntermediaryEventFn); @@ -50,7 +50,7 @@ test('method should create intermediary event on cancel', () => { test('method should create intermediary event on ResendSms', () => { const magic = createMagicSDK(); - magic.user.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.user.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); const createIntermediaryEventFn = jest.fn(); magic.user.createIntermediaryEvent = jest.fn().mockImplementation(() => createIntermediaryEventFn); @@ -64,7 +64,7 @@ test('method should create intermediary event on ResendSms', () => { test('method should create intermediary event on VerifyOtp', () => { const magic = createMagicSDK(); - magic.user.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.user.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); const createIntermediaryEventFn = jest.fn(); magic.user.createIntermediaryEvent = jest.fn().mockImplementation(() => createIntermediaryEventFn); @@ -78,7 +78,7 @@ test('method should create intermediary event on VerifyOtp', () => { test('method should create intermediary event on UpdateEmail', () => { const magic = createMagicSDK(); - magic.user.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.user.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); const createIntermediaryEventFn = jest.fn(); magic.user.createIntermediaryEvent = jest.fn().mockImplementation(() => createIntermediaryEventFn); @@ -92,7 +92,7 @@ test('method should create intermediary event on UpdateEmail', () => { test('method should create intermediary event on UpdateEmailEventEmit.Cancel', () => { const magic = createMagicSDK(); - magic.user.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.user.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); const createIntermediaryEventFn = jest.fn(); magic.user.createIntermediaryEvent = jest.fn().mockImplementation(() => createIntermediaryEventFn); @@ -106,7 +106,7 @@ test('method should create intermediary event on UpdateEmailEventEmit.Cancel', ( test('method should create intermediary event on RetryWithNewEmail', () => { const magic = createMagicSDK(); - magic.user.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.user.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); const createIntermediaryEventFn = jest.fn(); magic.user.createIntermediaryEvent = jest.fn().mockImplementation(() => createIntermediaryEventFn); @@ -120,7 +120,7 @@ test('method should create intermediary event on RetryWithNewEmail', () => { test('method should create intermediary event on VerifyEmailOtp', () => { const magic = createMagicSDK(); - magic.user.overlay.post = jest.fn().mockImplementation(() => new Promise(() => {})); + magic.user.overlay.post = jest.fn().mockImplementation(() => new Promise(() => { /* noop */ })); const createIntermediaryEventFn = jest.fn(); magic.user.createIntermediaryEvent = jest.fn().mockImplementation(() => createIntermediaryEventFn); diff --git a/packages/@magic-sdk/provider/test/spec/util/device-share-web-crypto.spec.ts b/packages/@magic-sdk/provider/test/spec/util/device-share-web-crypto.spec.ts index 2d24b1205..7cf08d6bb 100644 --- a/packages/@magic-sdk/provider/test/spec/util/device-share-web-crypto.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/device-share-web-crypto.spec.ts @@ -10,7 +10,7 @@ import { getDecryptedDeviceShare, } from '../../../src/util/device-share-web-crypto'; -let FAKE_STORE: Record = {}; +let FAKE_STORE: Record = {}; const FAKE_NETWORK_HASH = 'network_hash'; const FAKE_PLAINTEXT_SHARE = `AQICAHg1y7j1UY7sfTib6h9cN2Kh7v0WhCRwQxEPhGAQ2m5OgQGrJvUP6MKiuj9yD96y6B4eAAABPzCCATsGCSqGSIb3DQEHBqCCASwwggEoAgEAMIIBIQYJKoZIhvcNAQcBMB4GCWCGSAFlAwQBLjARBAy6tbGg/6//2IJs9xUCARCAgfOY3knm1i2kGjLXQFoqEjOeLr/UGwHQ+AW1y20UoCX3ght68egu06Hg54JF/mCGgSDt7R7dFSOuGvapE9OEyFYz4f1+tpWb5PPaLReBRTTTfw/8Xgsfzl6iXACsLKqyXEeWci+/vOWDLqu73E0uy5StyN5InZLwHCJe4l+KMEr5C7JZvobQh4NVBT5SqgQXmLGXGGH/2ydkq8zkgVGDT9jQlqqpUH83UMFQwHSwbJRRyYLxBwQKTO0AODfqk5OnWRA+BoDC8HMFyQUb4nS+BgDlgTgL7Kg/H/Echr+SlQKJdWJnvf3BjSBwO8z5kVpxRo5xwG4=`; diff --git a/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts b/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts index 804d20482..440a6db66 100644 --- a/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts @@ -1,4 +1,4 @@ -import { createPromiEvent } from '../../../../src/util/promise-tools'; +import { createPromiEvent, PromiEvent } from '../../../../src/util/promise-tools'; import { TypedEmitter } from '../../../../src/util/events'; type DefaultEvents = { @@ -19,50 +19,50 @@ beforeEach(() => { }); test('Creates a native `Promise`', () => { - const p = createPromiEvent(resolve => resolve(true)); + const promiEvent = createPromiEvent(resolve => resolve(true)); - expect(p instanceof Promise).toBe(true); + expect(promiEvent instanceof Promise).toBe(true); }); test('Attaches `TypedEmitter` methods to the initial value', () => { - const p = createPromiEvent(resolve => resolve(true)); + const promiEvent = createPromiEvent(resolve => resolve(true)); typedEmitterMethods.forEach(method => { - expect(typeof p[method as keyof typeof p] === 'function').toBe(true); + expect(typeof promiEvent[method as keyof typeof promiEvent] === 'function').toBe(true); }); }); test('Attaches `TypedEmitter` methods to `Promise.then` result', () => { - const p = createPromiEvent(resolve => resolve(true)).then(); + const promiEvent = createPromiEvent(resolve => resolve(true)).then(); typedEmitterMethods.forEach(method => { - expect(typeof p[method as keyof typeof p] === 'function').toBe(true); + expect(typeof promiEvent[method as keyof typeof promiEvent] === 'function').toBe(true); }); }); test('Attaches `TypedEmitter` methods to `Promise.catch` result', () => { - const p = createPromiEvent(resolve => resolve(true)).catch(); + const promiEvent = createPromiEvent(resolve => resolve(true)).catch(); typedEmitterMethods.forEach(method => { - expect(typeof p[method as keyof typeof p] === 'function').toBe(true); + expect(typeof promiEvent[method as keyof typeof promiEvent] === 'function').toBe(true); }); }); test('Attaches `TypedEmitter` methods to `Promise.finally` result', () => { - const p = createPromiEvent(resolve => resolve(true)).catch(); + const promiEvent = createPromiEvent(resolve => resolve(true)).catch(); typedEmitterMethods.forEach(method => { - expect(typeof p[method as keyof typeof p] === 'function').toBe(true); + expect(typeof promiEvent[method as keyof typeof promiEvent] === 'function').toBe(true); }); }); test('Attaches `Promise` methods to `TypedEmitter` results', () => { chainingEmitterMethods.forEach(emitterMethod => { const emitterStub = jest.spyOn(TypedEmitter.prototype, emitterMethod as any).mockImplementation(); - const p = createPromiEvent(resolve => resolve(true))[emitterMethod]('done', () => {}); + const promiEvent = createPromiEvent(resolve => resolve(true))[emitterMethod]('done', () => { /* noop */ }); promiseMethods.forEach(promiseMethod => { - expect(typeof (p as Record)[promiseMethod] === 'function').toBe(true); + expect(typeof promiEvent[promiseMethod as keyof typeof promiEvent] === 'function').toBe(true); }); emitterStub.mockReset(); @@ -89,7 +89,9 @@ test('Emits "error" event upon Promise reject', done => { expect(err).toBe('goodbye' as any); done(); }) - .catch(() => { }); + .catch(() => { + /* noop */ + }); }); test('Emits "settled" event upon Promise reject', done => { @@ -97,5 +99,7 @@ test('Emits "settled" event upon Promise reject', done => { .on('settled', () => { done(); }) - .catch(() => { }); + .catch(() => { + /* noop */ + }); }); diff --git a/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromise.spec.ts b/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromise.spec.ts index b443447fa..64f224058 100644 --- a/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromise.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromise.spec.ts @@ -5,9 +5,9 @@ beforeEach(() => { }); test('Creates a native `Promise`', () => { - const p = createPromise(resolve => resolve(true)); + const promiEvent = createPromise(resolve => resolve(true)); - expect(p instanceof Promise).toBe(true); + expect(promiEvent instanceof Promise).toBe(true); }); test('Resolves the `Promise`', done => { diff --git a/packages/@magic-sdk/provider/test/spec/util/promise-tools/isPromiEvent.spec.ts b/packages/@magic-sdk/provider/test/spec/util/promise-tools/isPromiEvent.spec.ts index 68736ed4a..d90d08d73 100644 --- a/packages/@magic-sdk/provider/test/spec/util/promise-tools/isPromiEvent.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/promise-tools/isPromiEvent.spec.ts @@ -5,13 +5,13 @@ beforeEach(() => { }); test('Returns `true` for valid `PromiEvent` object', () => { - const p = createPromiEvent(resolve => resolve(true)); + const promiEvent = createPromiEvent(resolve => resolve(true)); - expect(isPromiEvent(p)).toBe(true); + expect(isPromiEvent(promiEvent)).toBe(true); }); test('Returns `false` for invalid `PromiEvent` object', () => { - const p = {}; + const promiEvent = {}; - expect(isPromiEvent(p)).toBe(false); + expect(isPromiEvent(promiEvent)).toBe(false); }); diff --git a/packages/@magic-sdk/provider/test/spec/util/web-crypto.spec.ts b/packages/@magic-sdk/provider/test/spec/util/web-crypto.spec.ts index 4ee8ff20f..171870c40 100644 --- a/packages/@magic-sdk/provider/test/spec/util/web-crypto.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/web-crypto.spec.ts @@ -3,7 +3,7 @@ import * as storage from '../../../src/util/storage'; import { clearKeys, createJwt, STORE_KEY_PRIVATE_KEY, STORE_KEY_PUBLIC_JWK } from '../../../src/util/web-crypto'; import { TextEncoder } from 'util'; -let FAKE_STORE: Record = {}; +let FAKE_STORE: Record = {}; beforeAll(() => { jest.spyOn(storage, 'getItem').mockImplementation(async (key: string) => FAKE_STORE[key]); @@ -62,7 +62,7 @@ test('should store public and private keys after creating JWT', async () => { test('private key should be non exportable', async () => { await createJwt(); - const privateKey = FAKE_STORE[STORE_KEY_PRIVATE_KEY]; + const privateKey = FAKE_STORE[STORE_KEY_PRIVATE_KEY] as CryptoKey; expect(() => crypto.subtle.exportKey('jwk', privateKey)).rejects.toThrow(); }); From 070bb525a17f1210ea0b0d5d2e9a677534720583 Mon Sep 17 00:00:00 2001 From: sherzod-bakhodirov Date: Tue, 17 Dec 2024 17:10:53 +0500 Subject: [PATCH 10/13] fix: deepsourse --- .../provider/test/spec/core/view-controller/post.spec.ts | 4 ++-- .../test/spec/util/promise-tools/createPromiEvent.spec.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts b/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts index 51244a233..358b734aa 100644 --- a/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/core/view-controller/post.spec.ts @@ -78,7 +78,7 @@ beforeEach(() => { createJwtStub = jest.spyOn(webCryptoUtils, 'createJwt'); getDecryptedDeviceShareStub = jest.spyOn(deviceShareWebCryptoUtils, 'getDecryptedDeviceShare'); clearDeviceSharesStub = jest.spyOn(deviceShareWebCryptoUtils, 'clearDeviceShares'); - jest.spyOn(global.console, 'info').mockImplementation(() => { }); + jest.spyOn(global.console, 'info').mockImplementation(() => { /* noop */ }); jest.spyOn(global, 'addEventListener').mockImplementation(jest.fn()); jest.spyOn(storage, 'getItem').mockImplementation((key: string, callback?: (err: unknown, value: unknown) => void) => { const value = FAKE_STORE[key]; @@ -213,7 +213,7 @@ test('Sends payload without rt if no jwt can be made', async () => { }); test('Sends payload when web crypto jwt fails', async () => { - const consoleErrorStub = jest.spyOn(global.console, 'error').mockImplementationOnce(() => { }); + const consoleErrorStub = jest.spyOn(global.console, 'error').mockImplementationOnce(() => { /* noop */ }); createJwtStub.mockRejectedValueOnce('danger'); FAKE_STORE.rt = FAKE_RT; diff --git a/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts b/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts index 440a6db66..05309facd 100644 --- a/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts +++ b/packages/@magic-sdk/provider/test/spec/util/promise-tools/createPromiEvent.spec.ts @@ -1,4 +1,4 @@ -import { createPromiEvent, PromiEvent } from '../../../../src/util/promise-tools'; +import { createPromiEvent } from '../../../../src/util/promise-tools'; import { TypedEmitter } from '../../../../src/util/events'; type DefaultEvents = { From e09ddd303aa743c15f8025e6f1dee9f939df8040 Mon Sep 17 00:00:00 2001 From: sherzod-bakhodirov Date: Tue, 17 Dec 2024 18:46:54 +0500 Subject: [PATCH 11/13] fix: signTransaction type --- packages/@magic-ext/kadena/src/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/@magic-ext/kadena/src/index.ts b/packages/@magic-ext/kadena/src/index.ts index 02d32c72d..13ee4d6ce 100644 --- a/packages/@magic-ext/kadena/src/index.ts +++ b/packages/@magic-ext/kadena/src/index.ts @@ -29,7 +29,7 @@ export class KadenaExtension extends Extension.Internal<'kadena'> { } public signTransaction(hash: string): Promise { - return this.request(this.utils.createJsonRpcRequestPayload(KadenaPayloadMethod.KadenaSignTransaction, [{ hash }])); + return this.request(this.utils.createJsonRpcRequestPayload(KadenaPayloadMethod.KadenaSignTransaction, [{ hash }])); } public async signTransactionWithSpireKey( From 9970f1a51eb19e11a7323d2bfb74228421a49e02 Mon Sep 17 00:00:00 2001 From: sherzod-bakhodirov Date: Tue, 17 Dec 2024 19:58:52 +0500 Subject: [PATCH 12/13] feat: add test to react native --- .../_post.spec.ts | 21 +++++++++++++++++-- .../_post.spec.ts | 16 ++++++++++++++ 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/_post.spec.ts b/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/_post.spec.ts index a6e653277..d79fe53bd 100644 --- a/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/_post.spec.ts +++ b/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/_post.spec.ts @@ -1,6 +1,8 @@ import { createModalNotReadyError } from '@magic-sdk/provider'; import { createReactNativeWebViewController } from '../../factories'; import { reactNativeStyleSheetStub } from '../../mocks'; +import { ReactNativeWebViewController } from '../../../src/react-native-webview-controller'; +import AsyncStorage from '@react-native-async-storage/async-storage'; beforeEach(() => { jest.resetAllMocks(); @@ -12,12 +14,17 @@ const emitStub = jest.fn(); jest.mock('react-native-event-listeners', () => { return { EventRegister: { - emit: emitStub, + emit: (...args: unknown[]) => emitStub(...args), addEventListener: jest.fn(), }, }; }); +jest.mock('@react-native-async-storage/async-storage', () => ({ + getItem: jest.fn(), + setItem: jest.fn(), +})); + test('Calls webView._post with the expected arguments', async () => { const overlay = createReactNativeWebViewController('http://example.com'); @@ -67,6 +74,16 @@ test('Emits msg_posted_after_inactivity_event when msgPostedAfterInactivity retu overlay.msgPostedAfterInactivity = () => true; await overlay._post({ thisIsData: 'hello world' }); - expect(emitStub).toBeCalledTimes(1); + expect(emitStub).toHaveBeenCalledTimes(1); expect(emitStub).toHaveBeenCalledWith('msg_posted_after_inactivity_event', { thisIsData: 'hello world' }); }); + +test('returns true when more than 5 minutes have passed since the last post', async () => { + const controller = createReactNativeWebViewController('http://example.com'); + + const sixMinutesAgo = new Date(Date.now() - 6 * 60 * 1000).toISOString(); + (AsyncStorage.getItem as jest.Mock).mockResolvedValue(sixMinutesAgo); + const result = await (controller as any).msgPostedAfterInactivity(); + expect(result).toBe(true); + expect(AsyncStorage.getItem).toHaveBeenCalledWith('lastMessageTime'); +}) \ No newline at end of file diff --git a/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/_post.spec.ts b/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/_post.spec.ts index a6e653277..152cb60dc 100644 --- a/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/_post.spec.ts +++ b/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/_post.spec.ts @@ -1,6 +1,7 @@ import { createModalNotReadyError } from '@magic-sdk/provider'; import { createReactNativeWebViewController } from '../../factories'; import { reactNativeStyleSheetStub } from '../../mocks'; +import AsyncStorage from '@react-native-async-storage/async-storage'; beforeEach(() => { jest.resetAllMocks(); @@ -18,6 +19,11 @@ jest.mock('react-native-event-listeners', () => { }; }); +jest.mock('@react-native-async-storage/async-storage', () => ({ + getItem: jest.fn(), + setItem: jest.fn(), +})); + test('Calls webView._post with the expected arguments', async () => { const overlay = createReactNativeWebViewController('http://example.com'); @@ -70,3 +76,13 @@ test('Emits msg_posted_after_inactivity_event when msgPostedAfterInactivity retu expect(emitStub).toBeCalledTimes(1); expect(emitStub).toHaveBeenCalledWith('msg_posted_after_inactivity_event', { thisIsData: 'hello world' }); }); + +test('returns true when more than 5 minutes have passed since the last post', async () => { + const controller = createReactNativeWebViewController('http://example.com'); + + const sixMinutesAgo = new Date(Date.now() - 6 * 60 * 1000).toISOString(); + (AsyncStorage.getItem as jest.Mock).mockResolvedValue(sixMinutesAgo); + const result = await (controller as any).msgPostedAfterInactivity(); + expect(result).toBe(true); + expect(AsyncStorage.getItem).toHaveBeenCalledWith('lastMessageTime'); +}) \ No newline at end of file From 131be4a95f9e73ee537ff3d6bde6e1271e795e2d Mon Sep 17 00:00:00 2001 From: sherzod-bakhodirov Date: Tue, 17 Dec 2024 20:06:58 +0500 Subject: [PATCH 13/13] fix: deepsource --- .../test/spec/react-native-webview-controller/_post.spec.ts | 3 +-- .../test/spec/react-native-webview-controller/_post.spec.ts | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/_post.spec.ts b/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/_post.spec.ts index d79fe53bd..e9bc2a90d 100644 --- a/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/_post.spec.ts +++ b/packages/@magic-sdk/react-native-bare/test/spec/react-native-webview-controller/_post.spec.ts @@ -1,7 +1,6 @@ import { createModalNotReadyError } from '@magic-sdk/provider'; import { createReactNativeWebViewController } from '../../factories'; import { reactNativeStyleSheetStub } from '../../mocks'; -import { ReactNativeWebViewController } from '../../../src/react-native-webview-controller'; import AsyncStorage from '@react-native-async-storage/async-storage'; beforeEach(() => { @@ -83,7 +82,7 @@ test('returns true when more than 5 minutes have passed since the last post', as const sixMinutesAgo = new Date(Date.now() - 6 * 60 * 1000).toISOString(); (AsyncStorage.getItem as jest.Mock).mockResolvedValue(sixMinutesAgo); - const result = await (controller as any).msgPostedAfterInactivity(); + const result = await controller.msgPostedAfterInactivity(); expect(result).toBe(true); expect(AsyncStorage.getItem).toHaveBeenCalledWith('lastMessageTime'); }) \ No newline at end of file diff --git a/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/_post.spec.ts b/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/_post.spec.ts index 152cb60dc..bb1980bc6 100644 --- a/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/_post.spec.ts +++ b/packages/@magic-sdk/react-native-expo/test/spec/react-native-webview-controller/_post.spec.ts @@ -82,7 +82,7 @@ test('returns true when more than 5 minutes have passed since the last post', as const sixMinutesAgo = new Date(Date.now() - 6 * 60 * 1000).toISOString(); (AsyncStorage.getItem as jest.Mock).mockResolvedValue(sixMinutesAgo); - const result = await (controller as any).msgPostedAfterInactivity(); + const result = await controller.msgPostedAfterInactivity(); expect(result).toBe(true); expect(AsyncStorage.getItem).toHaveBeenCalledWith('lastMessageTime'); }) \ No newline at end of file