diff --git a/package-lock.json b/package-lock.json index 5ec9eb2996cd..f146928c21ad 100644 --- a/package-lock.json +++ b/package-lock.json @@ -124,8 +124,8 @@ "react-native-nitro-fetch": "1.6.2", "react-native-nitro-image": "0.15.2", "react-native-nitro-modules": "0.37.1", - "react-native-nitro-sqlite": "9.8.3", - "react-native-onyx": "3.0.119", + "react-native-nitro-sqlite": "10.2.0", + "react-native-onyx": "3.0.133", "react-native-pager-view": "9.0.4", "react-native-pdf": "7.0.2", "react-native-permissions": "^5.4.0", @@ -10251,6 +10251,7 @@ }, "node_modules/@isaacs/cliui": { "version": "8.0.2", + "dev": true, "license": "ISC", "dependencies": { "string-width": "^5.1.2", @@ -10266,6 +10267,7 @@ }, "node_modules/@isaacs/cliui/node_modules/ansi-regex": { "version": "6.0.1", + "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -10276,6 +10278,7 @@ }, "node_modules/@isaacs/cliui/node_modules/ansi-styles": { "version": "6.2.1", + "dev": true, "license": "MIT", "engines": { "node": ">=12" @@ -10286,10 +10289,12 @@ }, "node_modules/@isaacs/cliui/node_modules/emoji-regex": { "version": "9.2.2", + "dev": true, "license": "MIT" }, "node_modules/@isaacs/cliui/node_modules/string-width": { "version": "5.1.2", + "dev": true, "license": "MIT", "dependencies": { "eastasianwidth": "^0.2.0", @@ -10305,6 +10310,7 @@ }, "node_modules/@isaacs/cliui/node_modules/strip-ansi": { "version": "7.1.0", + "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^6.0.1" @@ -10318,6 +10324,7 @@ }, "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { "version": "8.1.0", + "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^6.1.0", @@ -14376,6 +14383,7 @@ }, "node_modules/@pkgjs/parseargs": { "version": "0.11.0", + "dev": true, "license": "MIT", "optional": true, "engines": { @@ -21674,9 +21682,9 @@ } }, "node_modules/ansis": { - "version": "3.17.0", - "resolved": "https://registry.npmjs.org/ansis/-/ansis-3.17.0.tgz", - "integrity": "sha512-0qWUglt9JEqLFr3w1I1pbrChn1grhaiAR2ocX1PP/flRmxgtwTzPFFFnfIlD6aMOLQZgSuCRlidD70lvx8yhzg==", + "version": "4.4.0", + "resolved": "https://registry.npmjs.org/ansis/-/ansis-4.4.0.tgz", + "integrity": "sha512-9k3v7xcHwgdO/DruxGIg4HtjvlAZlcnsX/mzqUb1t3NkYnl9kK2UJ+Gq0io+vQf7iT//BD/HB/NBkUR1LWxoeA==", "license": "ISC", "engines": { "node": ">=14" @@ -21707,15 +21715,6 @@ ], "license": "MIT" }, - "node_modules/app-root-path": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/app-root-path/-/app-root-path-3.1.0.tgz", - "integrity": "sha512-biN3PwB2gUtjaYy/isrU3aNWI5w+fAfvHkSvCKeQGxhmYpwKFUxudR3Yya+KqVRHBmEDYh+/lTozYCFbmzX4nA==", - "license": "MIT", - "engines": { - "node": ">= 6.0.0" - } - }, "node_modules/appdirsjs": { "version": "1.2.7", "devOptional": true, @@ -22633,6 +22632,7 @@ }, "node_modules/balanced-match": { "version": "1.0.2", + "devOptional": true, "license": "MIT" }, "node_modules/base-64": { @@ -24924,7 +24924,9 @@ } }, "node_modules/dayjs": { - "version": "1.11.13", + "version": "1.11.23", + "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.23.tgz", + "integrity": "sha512-QDTCU0M0MxR3hQfnlDJfwekQiaanm1ubOD231u73WBckQ/fsamwRLiE2GBz6D3a/xF1NgfiDLJjXBa1hYOYTtQ==", "license": "MIT" }, "node_modules/debug": { @@ -25311,6 +25313,7 @@ }, "node_modules/eastasianwidth": { "version": "0.2.0", + "dev": true, "license": "MIT" }, "node_modules/ecdsa-sig-formatter": { @@ -28321,6 +28324,7 @@ "version": "3.3.1", "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.3.1.tgz", "integrity": "sha512-gIXjKqtFuWEgzFRJA9WCQeSJLZDjgJUOMCMzxtvFq/37KojM1BFGufqsCy0r4qSQmYLsZYMeyRqzIWOMup03sw==", + "dev": true, "license": "ISC", "dependencies": { "cross-spawn": "^7.0.6", @@ -28335,6 +28339,7 @@ }, "node_modules/foreground-child/node_modules/signal-exit": { "version": "4.1.0", + "dev": true, "license": "ISC", "engines": { "node": ">=14" @@ -28789,6 +28794,7 @@ "version": "10.5.0", "resolved": "https://registry.npmjs.org/glob/-/glob-10.5.0.tgz", "integrity": "sha512-DfXN8DfhJ7NH3Oe7cFmu3NCu1wKbkReJ8TorzSAFbSKrlNaQSKfIzqYqVY8zlbs2NLBbWpRiU52GX2PbaBVNkg==", + "dev": true, "license": "ISC", "dependencies": { "foreground-child": "^3.1.0", @@ -28837,6 +28843,7 @@ "version": "2.1.7", "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.1.7.tgz", "integrity": "sha512-uZbew1NqdmPDTMJ8ah1y+b+9QEJrfkXFk3RcTQw3X0jW/xRUvFKsg1CfQdSYGdTbXZWExtU3J3ccxtnfw1Fi0g==", + "dev": true, "license": "MIT", "dependencies": { "balanced-match": "^1.0.0" @@ -28846,6 +28853,7 @@ "version": "9.0.9", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.9.tgz", "integrity": "sha512-OBwBN9AL4dqmETlpS2zasx+vTeWclWzkblfZk7KTA5j3jeOONz/tRCnZomUyvNg83wL5Zv9Ss6HMJXAgL8R2Yg==", + "dev": true, "license": "ISC", "dependencies": { "brace-expansion": "^2.0.2" @@ -30471,6 +30479,7 @@ }, "node_modules/jackspeak": { "version": "3.4.3", + "dev": true, "license": "BlueOak-1.0.0", "dependencies": { "@isaacs/cliui": "^8.0.2" @@ -35952,6 +35961,7 @@ }, "node_modules/package-json-from-dist": { "version": "1.0.0", + "dev": true, "license": "BlueOak-1.0.0" }, "node_modules/package-manager-detector": { @@ -36243,6 +36253,7 @@ }, "node_modules/path-scurry": { "version": "1.11.1", + "dev": true, "license": "BlueOak-1.0.0", "dependencies": { "lru-cache": "^10.2.0", @@ -36257,6 +36268,7 @@ }, "node_modules/path-scurry/node_modules/lru-cache": { "version": "10.2.0", + "dev": true, "license": "ISC", "engines": { "node": "14 || >=16.14" @@ -37622,188 +37634,29 @@ } }, "node_modules/react-native-nitro-sqlite": { - "version": "9.8.3", - "resolved": "https://registry.npmjs.org/react-native-nitro-sqlite/-/react-native-nitro-sqlite-9.8.3.tgz", - "integrity": "sha512-pw4ZNYNQiMiyJZr6bu0dg+IPTskoEngg1wZBD/H5bg1oyH1rJM4HfS5nVgU7jydibIMko1YhrHK+3m5AEndcDg==", + "version": "10.2.0", + "resolved": "https://registry.npmjs.org/react-native-nitro-sqlite/-/react-native-nitro-sqlite-10.2.0.tgz", + "integrity": "sha512-lB0yc4SzVNTZoe0ItyBJqOQ9qAc2SY3ku7PzFwP97e4NpZIOX0ec7p49sLK04MdWRmInt96Q7NU4rPfbNyg7Nw==", "license": "MIT", "dependencies": { - "typeorm": "0.3.27" + "typeorm": "1.1.1" }, "peerDependencies": { + "better-sqlite3": "^12.11.1", "react": ">=17.0.0", "react-native": ">=0.75.0", "react-native-nitro-modules": ">=0.35.0" - } - }, - "node_modules/react-native-nitro-sqlite/node_modules/buffer": { - "version": "6.0.3", - "resolved": "https://registry.npmjs.org/buffer/-/buffer-6.0.3.tgz", - "integrity": "sha512-FTiCpNxtwiZZHEZbcbTIcZjERVICn9yq/pDFkTl95/AxzD1naBctN7YO68riM/gLSDY7sdrMby8hofADYuuqOA==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT", - "dependencies": { - "base64-js": "^1.3.1", - "ieee754": "^1.2.1" - } - }, - "node_modules/react-native-nitro-sqlite/node_modules/dedent": { - "version": "1.7.2", - "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.7.2.tgz", - "integrity": "sha512-WzMx3mW98SN+zn3hgemf4OzdmyNhhhKz5Ay0pUfQiMQ3e1g+xmTJWp/pKdwKVXhdSkAEGIIzqeuWrL3mV/AXbA==", - "license": "MIT", - "peerDependencies": { - "babel-plugin-macros": "^3.1.0" }, "peerDependenciesMeta": { - "babel-plugin-macros": { - "optional": true - } - } - }, - "node_modules/react-native-nitro-sqlite/node_modules/dotenv": { - "version": "16.6.1", - "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.6.1.tgz", - "integrity": "sha512-uBq4egWHTcTt33a72vpSG0z3HnPuIl6NqYcTrKEg2azoEyl2hpW0zqlxysq2pK9HlDIHyHyakeYaYnSAwd8bow==", - "license": "BSD-2-Clause", - "engines": { - "node": ">=12" - }, - "funding": { - "url": "https://dotenvx.com" - } - }, - "node_modules/react-native-nitro-sqlite/node_modules/typeorm": { - "version": "0.3.27", - "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-0.3.27.tgz", - "integrity": "sha512-pNV1bn+1n8qEe8tUNsNdD8ejuPcMAg47u2lUGnbsajiNUr3p2Js1XLKQjBMH0yMRMDfdX8T+fIRejFmIwy9x4A==", - "license": "MIT", - "dependencies": { - "@sqltools/formatter": "^1.2.5", - "ansis": "^3.17.0", - "app-root-path": "^3.1.0", - "buffer": "^6.0.3", - "dayjs": "^1.11.13", - "debug": "^4.4.0", - "dedent": "^1.6.0", - "dotenv": "^16.4.7", - "glob": "^10.4.5", - "sha.js": "^2.4.12", - "sql-highlight": "^6.0.0", - "tslib": "^2.8.1", - "uuid": "^11.1.0", - "yargs": "^17.7.2" - }, - "bin": { - "typeorm": "cli.js", - "typeorm-ts-node-commonjs": "cli-ts-node-commonjs.js", - "typeorm-ts-node-esm": "cli-ts-node-esm.js" - }, - "engines": { - "node": ">=16.13.0" - }, - "funding": { - "url": "https://opencollective.com/typeorm" - }, - "peerDependencies": { - "@google-cloud/spanner": "^5.18.0 || ^6.0.0 || ^7.0.0", - "@sap/hana-client": "^2.14.22", - "better-sqlite3": "^8.0.0 || ^9.0.0 || ^10.0.0 || ^11.0.0 || ^12.0.0", - "ioredis": "^5.0.4", - "mongodb": "^5.8.0 || ^6.0.0", - "mssql": "^9.1.1 || ^10.0.1 || ^11.0.1", - "mysql2": "^2.2.5 || ^3.0.1", - "oracledb": "^6.3.0", - "pg": "^8.5.1", - "pg-native": "^3.0.0", - "pg-query-stream": "^4.0.0", - "redis": "^3.1.1 || ^4.0.0 || ^5.0.14", - "reflect-metadata": "^0.1.14 || ^0.2.0", - "sql.js": "^1.4.0", - "sqlite3": "^5.0.3", - "ts-node": "^10.7.0", - "typeorm-aurora-data-api-driver": "^2.0.0 || ^3.0.0" - }, - "peerDependenciesMeta": { - "@google-cloud/spanner": { - "optional": true - }, - "@sap/hana-client": { - "optional": true - }, "better-sqlite3": { "optional": true - }, - "ioredis": { - "optional": true - }, - "mongodb": { - "optional": true - }, - "mssql": { - "optional": true - }, - "mysql2": { - "optional": true - }, - "oracledb": { - "optional": true - }, - "pg": { - "optional": true - }, - "pg-native": { - "optional": true - }, - "pg-query-stream": { - "optional": true - }, - "redis": { - "optional": true - }, - "sql.js": { - "optional": true - }, - "sqlite3": { - "optional": true - }, - "ts-node": { - "optional": true - }, - "typeorm-aurora-data-api-driver": { - "optional": true } } }, - "node_modules/react-native-nitro-sqlite/node_modules/uuid": { - "version": "11.1.0", - "resolved": "https://registry.npmjs.org/uuid/-/uuid-11.1.0.tgz", - "integrity": "sha512-0/A9rDy9P7cJ+8w1c9WD9V//9Wj15Ce2MPz8Ri6032usz+NfePxx5AcN3bN+r6ZL6jEo066/yNYB3tn4pQEx+A==", - "funding": [ - "https://github.com/sponsors/broofa", - "https://github.com/sponsors/ctavan" - ], - "license": "MIT", - "bin": { - "uuid": "dist/esm/bin/uuid" - } - }, "node_modules/react-native-onyx": { - "version": "3.0.119", - "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-3.0.119.tgz", - "integrity": "sha512-1idaVW/nP0jTSjjevAzzMlk6gOLqkmT6gJaDYI0fWx21vtQLJ0gZeMEJb16g08Bd9nY4bsALWb4bkzhmiLWIfw==", + "version": "3.0.133", + "resolved": "https://registry.npmjs.org/react-native-onyx/-/react-native-onyx-3.0.133.tgz", + "integrity": "sha512-0aLcDy9hTjdXqNxXoblJb6fyYa/V11RwCfvepKJ+iK/tUYt4ST2TxkwvI10QEup1fAhgSkz8FvzkSiM/JXYS/Q==", "license": "MIT", "dependencies": { "ascii-table": "0.0.9", @@ -37812,7 +37665,7 @@ "lodash.clone": "^4.5.0", "lodash.pick": "^4.4.0", "lodash.transform": "^4.6.0", - "underscore": "^1.13.6", + "underscore": "^1.13.8", "use-sync-external-store": "^1.6.0" }, "engines": { @@ -37825,7 +37678,7 @@ "react-native": ">=0.75.0", "react-native-device-info": "^10.3.0", "react-native-nitro-modules": ">=0.35.0", - "react-native-nitro-sqlite": "^9.6.0" + "react-native-nitro-sqlite": "^10.2.0" }, "peerDependenciesMeta": { "idb-keyval": { @@ -38650,8 +38503,7 @@ "version": "0.2.2", "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.2.2.tgz", "integrity": "sha512-urBwgfrvVP/eAyXx4hluJivBKzuEbSQs9rKWCrCkbSxNv8mxPcUZKeuoF3Uy4mJl3Lwprp6yy5/39VWigZ4K6Q==", - "license": "Apache-2.0", - "peer": true + "license": "Apache-2.0" }, "node_modules/reflect.getprototypeof": { "version": "1.0.10", @@ -39565,46 +39417,6 @@ "node": ">=10" } }, - "node_modules/sha.js": { - "version": "2.4.12", - "resolved": "https://registry.npmjs.org/sha.js/-/sha.js-2.4.12.tgz", - "integrity": "sha512-8LzC5+bvI45BjpfXU8V5fdU2mfeKiQe1D1gIMn7XUlF3OTUrpdJpPPH4EMAnF0DsHHdSZqCdSss5qCmJKuiO3w==", - "license": "(MIT AND BSD-3-Clause)", - "dependencies": { - "inherits": "^2.0.4", - "safe-buffer": "^5.2.1", - "to-buffer": "^1.2.0" - }, - "bin": { - "sha.js": "bin.js" - }, - "engines": { - "node": ">= 0.10" - }, - "funding": { - "url": "https://github.com/sponsors/ljharb" - } - }, - "node_modules/sha.js/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, "node_modules/shallow-clone": { "version": "3.0.1", "dev": true, @@ -41400,6 +41212,7 @@ "node_modules/string-width-cjs": { "name": "string-width", "version": "4.2.3", + "dev": true, "license": "MIT", "dependencies": { "emoji-regex": "^8.0.0", @@ -41559,6 +41372,7 @@ "node_modules/strip-ansi-cjs": { "name": "strip-ansi", "version": "6.0.1", + "dev": true, "license": "MIT", "dependencies": { "ansi-regex": "^5.0.1" @@ -41569,6 +41383,7 @@ }, "node_modules/strip-ansi-cjs/node_modules/ansi-regex": { "version": "5.0.1", + "dev": true, "license": "MIT", "engines": { "node": ">=8" @@ -42291,40 +42106,6 @@ "version": "1.0.5", "license": "BSD-3-Clause" }, - "node_modules/to-buffer": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/to-buffer/-/to-buffer-1.2.2.tgz", - "integrity": "sha512-db0E3UJjcFhpDhAF4tLo03oli3pwl3dbnzXOUIlRKrp+ldk/VUxzpWYZENsw2SZiuBjHAk7DfB0VU7NKdpb6sw==", - "license": "MIT", - "dependencies": { - "isarray": "^2.0.5", - "safe-buffer": "^5.2.1", - "typed-array-buffer": "^1.0.3" - }, - "engines": { - "node": ">= 0.4" - } - }, - "node_modules/to-buffer/node_modules/safe-buffer": { - "version": "5.2.1", - "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", - "integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==", - "funding": [ - { - "type": "github", - "url": "https://github.com/sponsors/feross" - }, - { - "type": "patreon", - "url": "https://www.patreon.com/feross" - }, - { - "type": "consulting", - "url": "https://feross.org/support" - } - ], - "license": "MIT" - }, "node_modules/to-regex-range": { "version": "5.0.1", "license": "MIT", @@ -42640,6 +42421,158 @@ "node": ">= 18" } }, + "node_modules/typeorm": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/typeorm/-/typeorm-1.1.1.tgz", + "integrity": "sha512-og9mG4Lwlvj6MfvYd8yRCzXy73gETtwgTKQ/ISLYvEOpJPy4IrjU/89HK4ZAFmRIbEg1hkIk04v8phTrxfgPmQ==", + "license": "MIT", + "dependencies": { + "@sqltools/formatter": "^1.2.5", + "ansis": "^4.3.1", + "dayjs": "^1.11.21", + "debug": "^4.4.3", + "dedent": "^1.7.2", + "reflect-metadata": "^0.2.2", + "sql-highlight": "^6.1.0", + "tinyglobby": "^0.2.17", + "tslib": "^2.8.1", + "yargs": "^18.0.0" + }, + "bin": { + "typeorm": "cli.js", + "typeorm-ts-node-commonjs": "cli-ts-node-commonjs.js", + "typeorm-ts-node-esm": "cli-ts-node-esm.js" + }, + "engines": { + "node": "^20.19.0 || ^22.13.0 || >=24.11.0" + }, + "funding": { + "url": "https://opencollective.com/typeorm" + }, + "peerDependencies": { + "@google-cloud/spanner": "^8.0.0", + "@sap/hana-client": "^2.14.22", + "better-sqlite3": "^12.0.0", + "ioredis": "^5.0.4", + "mongodb": "^7.0.0", + "mssql": "^12.0.0", + "mysql2": "^3.15.3", + "oracledb": "^6.3.0 || ^7.0.0", + "pg": "^8.5.1", + "pg-native": "^3.0.0", + "pg-query-stream": "^4.0.0", + "redis": "^5.0.0 || ^6.0.0", + "sql.js": "^1.4.0", + "ts-node": "^10.9.2", + "typeorm-aurora-data-api-driver": "^3.0.0" + }, + "peerDependenciesMeta": { + "@google-cloud/spanner": { + "optional": true + }, + "@sap/hana-client": { + "optional": true + }, + "better-sqlite3": { + "optional": true + }, + "ioredis": { + "optional": true + }, + "mongodb": { + "optional": true + }, + "mssql": { + "optional": true + }, + "mysql2": { + "optional": true + }, + "oracledb": { + "optional": true + }, + "pg": { + "optional": true + }, + "pg-native": { + "optional": true + }, + "pg-query-stream": { + "optional": true + }, + "redis": { + "optional": true + }, + "sql.js": { + "optional": true + }, + "ts-node": { + "optional": true + }, + "typeorm-aurora-data-api-driver": { + "optional": true + } + } + }, + "node_modules/typeorm/node_modules/dedent": { + "version": "1.7.2", + "resolved": "https://registry.npmjs.org/dedent/-/dedent-1.7.2.tgz", + "integrity": "sha512-WzMx3mW98SN+zn3hgemf4OzdmyNhhhKz5Ay0pUfQiMQ3e1g+xmTJWp/pKdwKVXhdSkAEGIIzqeuWrL3mV/AXbA==", + "license": "MIT", + "peerDependencies": { + "babel-plugin-macros": "^3.1.0" + }, + "peerDependenciesMeta": { + "babel-plugin-macros": { + "optional": true + } + } + }, + "node_modules/typeorm/node_modules/fdir": { + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "license": "MIT", + "engines": { + "node": ">=12.0.0" + }, + "peerDependencies": { + "picomatch": "^3 || ^4" + }, + "peerDependenciesMeta": { + "picomatch": { + "optional": true + } + } + }, + "node_modules/typeorm/node_modules/picomatch": { + "version": "4.0.7", + "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.7.tgz", + "integrity": "sha512-qcJu88Q2IWqJsDD529JKMdwGm/dvInW4HvQnRwiH9JtihJvzGOscDtHE3x1pBKeUOTysQ8kVmLnJ2kJu7yhcGA==", + "license": "MIT", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/jonschlinkert" + } + }, + "node_modules/typeorm/node_modules/tinyglobby": { + "version": "0.2.17", + "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", + "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", + "license": "MIT", + "dependencies": { + "fdir": "^6.5.0", + "picomatch": "^4.0.4" + }, + "engines": { + "node": ">=12.0.0" + }, + "funding": { + "url": "https://github.com/sponsors/SuperchupuDev" + } + }, "node_modules/typescript": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/typescript/-/typescript-7.0.2.tgz", @@ -43887,6 +43820,7 @@ "node_modules/wrap-ansi-cjs": { "name": "wrap-ansi", "version": "7.0.0", + "dev": true, "license": "MIT", "dependencies": { "ansi-styles": "^4.0.0", @@ -43902,6 +43836,7 @@ }, "node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { "version": "4.3.0", + "dev": true, "license": "MIT", "dependencies": { "color-convert": "^2.0.1" @@ -43915,6 +43850,7 @@ }, "node_modules/wrap-ansi-cjs/node_modules/color-convert": { "version": "2.0.1", + "dev": true, "license": "MIT", "dependencies": { "color-name": "~1.1.4" @@ -43925,6 +43861,7 @@ }, "node_modules/wrap-ansi-cjs/node_modules/color-name": { "version": "1.1.4", + "dev": true, "license": "MIT" }, "node_modules/wrap-ansi/node_modules/ansi-styles": { diff --git a/package.json b/package.json index c0249ccfc343..a4631f27e7a2 100644 --- a/package.json +++ b/package.json @@ -200,8 +200,8 @@ "react-native-nitro-fetch": "1.6.2", "react-native-nitro-image": "0.15.2", "react-native-nitro-modules": "0.37.1", - "react-native-nitro-sqlite": "9.8.3", - "react-native-onyx": "3.0.119", + "react-native-nitro-sqlite": "10.2.0", + "react-native-onyx": "3.0.133", "react-native-pager-view": "9.0.4", "react-native-pdf": "7.0.2", "react-native-permissions": "^5.4.0", diff --git a/src/components/MultifactorAuthentication/Context/MultifactorAuthenticationMainContext.tsx b/src/components/MultifactorAuthentication/Context/MultifactorAuthenticationMainContext.tsx index f1583076e436..e483d852fd26 100644 --- a/src/components/MultifactorAuthentication/Context/MultifactorAuthenticationMainContext.tsx +++ b/src/components/MultifactorAuthentication/Context/MultifactorAuthenticationMainContext.tsx @@ -92,7 +92,7 @@ function MultifactorAuthenticationContextProvider({children}: MultifactorAuthent deviceBiometricsState = data; }, }); - return () => Onyx.disconnect(connection); + return () => connection.unsubscribe(); }, [accountID]); const startStateRef = useRef(undefined); diff --git a/src/libs/ConciergeResponseIndicator/index.ts b/src/libs/ConciergeResponseIndicator/index.ts index 342274899bcd..fc4c721989b9 100644 --- a/src/libs/ConciergeResponseIndicator/index.ts +++ b/src/libs/ConciergeResponseIndicator/index.ts @@ -311,10 +311,10 @@ function subscribeToReport(responseReportActionID: string, reportID: string) { }, }); if (reportSubscriptions.get(reportID) !== reportSubscription) { - Onyx.disconnect(reportConnection); + reportConnection.unsubscribe(); return; } - reportSubscription.cleanups.push(() => Onyx.disconnect(reportConnection)); + reportSubscription.cleanups.push(() => reportConnection.unsubscribe()); // Watch only the question/response reports while a request is tracked. This non-render // subscription detects failed sends and reconciles durable replies after missed events. @@ -329,10 +329,10 @@ function subscribeToReport(responseReportActionID: string, reportID: string) { }); // The initial callback can finish the last request before connectWithoutView returns. if (reportSubscriptions.get(reportID) !== reportSubscription) { - Onyx.disconnect(connection); + connection.unsubscribe(); return; } - reportSubscription.cleanups.push(() => Onyx.disconnect(connection)); + reportSubscription.cleanups.push(() => connection.unsubscribe()); } /** Register a local or peer request without broadcasting it back to other tabs. */ diff --git a/src/libs/Network/SequentialQueue.ts b/src/libs/Network/SequentialQueue.ts index 24fe33b21c1a..aae36752426d 100644 --- a/src/libs/Network/SequentialQueue.ts +++ b/src/libs/Network/SequentialQueue.ts @@ -694,7 +694,7 @@ function flush(shouldResetPromise = true) { requestsLength: getAllPersistedRequests().length, ongoingCommand: getPersistedOngoingRequest()?.command ?? 'null', }); - Onyx.disconnect(connection); + connection.unsubscribe(); process().finally(() => { const remainingPersistedRequests = getAllPersistedRequests().length; const hasOngoingRequest = !!getPersistedOngoingRequest(); diff --git a/src/libs/actions/Device/index.ts b/src/libs/actions/Device/index.ts index 1be531989c44..e0dc3626c297 100644 --- a/src/libs/actions/Device/index.ts +++ b/src/libs/actions/Device/index.ts @@ -24,7 +24,7 @@ function getDeviceID(): Promise { const connection = Onyx.connectWithoutView({ key: ONYXKEYS.DEVICE_ID, callback: (id) => { - Onyx.disconnect(connection); + connection.unsubscribe(); deviceID = id ?? null; return resolve(id ?? null); }, diff --git a/src/libs/actions/Export.ts b/src/libs/actions/Export.ts index 157da051d2aa..772ef8c6223c 100644 --- a/src/libs/actions/Export.ts +++ b/src/libs/actions/Export.ts @@ -76,7 +76,7 @@ function clearStaleExportDownloads() { const connectionID = Onyx.connectWithoutView({ key: ONYXKEYS.COLLECTION.EXPORT_DOWNLOAD, callback: (exportDownloads) => { - Onyx.disconnect(connectionID); + connectionID.unsubscribe(); if (!exportDownloads) { return; } diff --git a/src/libs/actions/ImportSpreadsheet.ts b/src/libs/actions/ImportSpreadsheet.ts index 2e1e10ebb9b9..9c714f860ae8 100644 --- a/src/libs/actions/ImportSpreadsheet.ts +++ b/src/libs/actions/ImportSpreadsheet.ts @@ -120,7 +120,7 @@ function waitForImportFinalModal(importFinalModalID: string): ImportFinalModalRe } isPending = false; - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(spreadsheet.importFinalModal); }, }); @@ -134,7 +134,7 @@ function waitForImportFinalModal(importFinalModalID: string): ImportFinalModalRe } isPending = false; - Onyx.disconnect(connection); + connection.unsubscribe(); }, }; } diff --git a/src/libs/actions/Link.ts b/src/libs/actions/Link.ts index 8adfc8a4dfa2..25ad22f49b3c 100644 --- a/src/libs/actions/Link.ts +++ b/src/libs/actions/Link.ts @@ -564,7 +564,7 @@ function openReportFromDeepLink( const handleDeeplinkNavigation = () => { // We want to disconnect the connection so it won't trigger the deeplink again // every time the data is changed, for example, when re-login. - Onyx.disconnect(connection); + connection.unsubscribe(); const state = navigationRef.getRootState(); const currentFocusedRoute = findFocusedRoute(state); @@ -615,7 +615,7 @@ function openReportFromDeepLink( if (!report?.errorFields?.notFound && !report?.reportID && !(report === undefined && CONST.REGEX.NON_NUMERIC.test(reportID))) { return; } - Onyx.disconnect(reportConnection); + reportConnection.unsubscribe(); navigateHandler(report); }, }); @@ -646,7 +646,7 @@ function openReportFromDeepLink( if (isLoadingReportData) { return; } - Onyx.disconnect(loadingConnection); + loadingConnection.unsubscribe(); // The concierge route is a URL entry page that redirects itself, and on wide layouts it slides in as a // panel first, so open the chat the way the rest of the app does instead. diff --git a/src/libs/actions/MapboxToken.ts b/src/libs/actions/MapboxToken.ts index d1eb3e6057f4..d8065f08fb79 100644 --- a/src/libs/actions/MapboxToken.ts +++ b/src/libs/actions/MapboxToken.ts @@ -140,7 +140,7 @@ const init = () => { const stop = () => { console.debug('[MapboxToken] Stopping all listeners and timers'); if (tokenConnection) { - Onyx.disconnect(tokenConnection); + tokenConnection.unsubscribe(); tokenConnection = null; } if (unsubscribeReachability) { diff --git a/src/libs/actions/OnyxDerived/index.ts b/src/libs/actions/OnyxDerived/index.ts index 06871b48783a..1b96c739e1e2 100644 --- a/src/libs/actions/OnyxDerived/index.ts +++ b/src/libs/actions/OnyxDerived/index.ts @@ -64,7 +64,7 @@ function init() { const connection = Onyx.connectWithoutView({ key, callback: (storedDerivedValue) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(storedDerivedValue); }, }); diff --git a/src/libs/actions/Report/DeferredAttachmentEdits.ts b/src/libs/actions/Report/DeferredAttachmentEdits.ts index e9ea1389dcd2..c9639abb8ea6 100644 --- a/src/libs/actions/Report/DeferredAttachmentEdits.ts +++ b/src/libs/actions/Report/DeferredAttachmentEdits.ts @@ -44,14 +44,14 @@ function watchDeferredAttachmentEdit(reportActionID: string, deferredEdit: Defer hasStopped = true; deferredAttachmentEditWatchers.delete(reportActionID); for (const connection of connections.splice(0)) { - Onyx.disconnect(connection); + connection.unsubscribe(); } }; // A subscriber can fire while it is still being connected, so a connection made after the watcher stopped is // disconnected rather than stored. const track = (connection: Connection) => { if (hasStopped) { - Onyx.disconnect(connection); + connection.unsubscribe(); return; } connections.push(connection); diff --git a/src/libs/actions/Report/index.ts b/src/libs/actions/Report/index.ts index 314d9387fc45..7ba98ad786b7 100644 --- a/src/libs/actions/Report/index.ts +++ b/src/libs/actions/Report/index.ts @@ -2772,7 +2772,7 @@ function navigateToAndOpenReport({ callback: (updatedReport) => { const notFoundError = updatedReport?.errorFields?.notFound; if (notFoundError === null) { - Onyx.disconnect(reportConnection); + reportConnection.unsubscribe(); return; } @@ -2781,7 +2781,7 @@ function navigateToAndOpenReport({ } hasAttemptedFallback = true; - Onyx.disconnect(reportConnection); + reportConnection.unsubscribe(); createAndOpenNewOptimisticChat(chat.reportID); }, }); @@ -2938,7 +2938,7 @@ function navigateToAndOpenReportWithAccountIDs( callback: (updatedReport) => { const notFoundError = updatedReport?.errorFields?.notFound; if (notFoundError === null) { - Onyx.disconnect(reportConnection); + reportConnection.unsubscribe(); return; } @@ -2947,7 +2947,7 @@ function navigateToAndOpenReportWithAccountIDs( } hasAttemptedFallback = true; - Onyx.disconnect(reportConnection); + reportConnection.unsubscribe(); createAndOpenNewOptimisticChat(chat.reportID); }, }); diff --git a/src/libs/actions/TransactionEdit.ts b/src/libs/actions/TransactionEdit.ts index 52d6f73bc2a4..d64bf2d00c1b 100644 --- a/src/libs/actions/TransactionEdit.ts +++ b/src/libs/actions/TransactionEdit.ts @@ -11,7 +11,7 @@ import Onyx from 'react-native-onyx'; import {generateTransactionID} from './Transaction'; -let connection: Connection; +let connection: Connection | undefined; /** * Makes a backup copy of a transaction object that can be restored when the user cancels editing a transaction. @@ -24,7 +24,7 @@ function createBackupTransaction(transaction: OnyxEntry, isDraft: b // In Strict Mode, the backup logic useEffect is triggered twice on mount. The restore logic is delayed because we need to connect to the onyx first, // so it's possible that the restore logic is executed after creating the backup for the 2nd time which will completely clear the backup. // To avoid that, we need to cancel the pending connection. - Onyx.disconnect(connection); + connection?.unsubscribe(); const newTransaction = { ...transaction, }; @@ -41,7 +41,7 @@ function createBackupTransaction(transaction: OnyxEntry, isDraft: b const conn = Onyx.connectWithoutView({ key: `${ONYXKEYS.COLLECTION.TRANSACTION_BACKUP}${transaction.transactionID}`, callback: (transactionBackup) => { - Onyx.disconnect(conn); + conn.unsubscribe(); // Treat a backup missing `transactionID` as corrupted (a partial route-fetch shape can // leak in via Pusher) and overwrite it instead of restoring from it. if (transactionBackup?.transactionID) { @@ -76,7 +76,7 @@ function restoreOriginalTransactionFromBackup(transactionID: string | undefined, connection = Onyx.connectWithoutView({ key: `${ONYXKEYS.COLLECTION.TRANSACTION_BACKUP}${transactionID}`, callback: (backupTransaction) => { - Onyx.disconnect(connection); + connection?.unsubscribe(); // Use set to completely overwrite the original transaction Onyx.set(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, backupTransaction ?? null); @@ -197,11 +197,11 @@ function removeBackupTransactionWithImageCleanup(transactionID: string | undefin const backupConn = Onyx.connectWithoutView({ key: `${ONYXKEYS.COLLECTION.TRANSACTION_BACKUP}${transactionID}`, callback: (backupTransaction) => { - Onyx.disconnect(backupConn); + backupConn.unsubscribe(); const currentConn = Onyx.connectWithoutView({ key: `${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, callback: (currentTransaction) => { - Onyx.disconnect(currentConn); + currentConn.unsubscribe(); revokeOdometerImageUri(backupTransaction?.comment?.odometerStartImage, currentTransaction?.comment?.odometerStartImage); revokeOdometerImageUri(backupTransaction?.comment?.odometerEndImage, currentTransaction?.comment?.odometerEndImage); removeBackupTransaction(transactionID); @@ -220,11 +220,11 @@ function restoreOriginalTransactionFromBackupWithImageCleanup(transactionID: str connection = Onyx.connectWithoutView({ key: `${ONYXKEYS.COLLECTION.TRANSACTION_BACKUP}${transactionID}`, callback: (backupTransaction) => { - Onyx.disconnect(connection); + connection?.unsubscribe(); const currentConn = Onyx.connectWithoutView({ key: `${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, callback: (currentTransaction) => { - Onyx.disconnect(currentConn); + currentConn.unsubscribe(); revokeOdometerImageUri(currentTransaction?.comment?.odometerStartImage, backupTransaction?.comment?.odometerStartImage); revokeOdometerImageUri(currentTransaction?.comment?.odometerEndImage, backupTransaction?.comment?.odometerEndImage); Onyx.set(`${isDraft ? ONYXKEYS.COLLECTION.TRANSACTION_DRAFT : ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, backupTransaction ?? null) diff --git a/src/libs/actions/User.ts b/src/libs/actions/User.ts index bab59da590b1..0f2428ea2e54 100644 --- a/src/libs/actions/User.ts +++ b/src/libs/actions/User.ts @@ -765,7 +765,7 @@ const isChannelMuted = (reportId: string, currentUserAccountID: number) => const connection = Onyx.connectWithoutView({ key: `${ONYXKEYS.COLLECTION.REPORT}${reportId}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const notificationPreference = report?.participants?.[currentUserAccountID]?.notificationPreference; resolve(!notificationPreference || notificationPreference === CONST.REPORT.NOTIFICATION_PREFERENCE.MUTE || ReportUtils.isHiddenForCurrentUser(notificationPreference)); diff --git a/src/libs/cleanupPreMountedDraftReports.ts b/src/libs/cleanupPreMountedDraftReports.ts index fdb0b8c3c198..a7395c40e6bc 100644 --- a/src/libs/cleanupPreMountedDraftReports.ts +++ b/src/libs/cleanupPreMountedDraftReports.ts @@ -39,7 +39,7 @@ function cleanupReportDrafts(markers: OnyxCollection) { let reportDraftsConnection: ReturnType; function handleReportDrafts(reportDrafts: OnyxCollection) { - Onyx.disconnect(reportDraftsConnection); + reportDraftsConnection.unsubscribe(); Onyx.multiSet(getPreMountedDraftReportCleanupData(markers, reportDrafts)); } @@ -60,7 +60,7 @@ function cleanupPreMountedDraftReports() { let markersConnection: ReturnType; function handleMarkers(markers: OnyxCollection) { - Onyx.disconnect(markersConnection); + markersConnection.unsubscribe(); if (!Object.keys(markers ?? {}).length) { return; } diff --git a/src/libs/migrations/MoveFilesOutOfDocuments/index.native.ts b/src/libs/migrations/MoveFilesOutOfDocuments/index.native.ts index c3eb07f1501c..35fb2a05c411 100644 --- a/src/libs/migrations/MoveFilesOutOfDocuments/index.native.ts +++ b/src/libs/migrations/MoveFilesOutOfDocuments/index.native.ts @@ -68,7 +68,7 @@ function updateAttachmentRecordPaths(): Promise { const connection = Onyx.connectWithoutView({ key: ONYXKEYS.ATTACHMENT_RECORD_PATHS_MIGRATED, callback: (hasMigrated) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(hasMigrated); }, }); @@ -81,7 +81,7 @@ function updateAttachmentRecordPaths(): Promise { const connection = Onyx.connectWithoutView({ key: ONYXKEYS.COLLECTION.ATTACHMENT, callback: (attachments: OnyxCollection) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const updates: Record = {}; for (const [key, attachment] of Object.entries(attachments ?? {})) { diff --git a/src/libs/migrations/RenameLegacySageIntacctExportDate.ts b/src/libs/migrations/RenameLegacySageIntacctExportDate.ts index e04773a4158c..6e88f14f0cc0 100644 --- a/src/libs/migrations/RenameLegacySageIntacctExportDate.ts +++ b/src/libs/migrations/RenameLegacySageIntacctExportDate.ts @@ -25,7 +25,7 @@ export default function RenameLegacySageIntacctExportDate(): Promise { const connection = Onyx.connectWithoutView({ key: ONYXKEYS.COLLECTION.POLICY, callback: (policies: OnyxCollection) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const updates: OnyxMergeCollectionInput = {}; for (const policy of Object.values(policies ?? {})) { diff --git a/src/libs/readOnceOnyxValue.ts b/src/libs/readOnceOnyxValue.ts index 794048e6d59f..166fcdcc4a24 100644 --- a/src/libs/readOnceOnyxValue.ts +++ b/src/libs/readOnceOnyxValue.ts @@ -8,7 +8,7 @@ function readOnceOnyxValue(key: TKey): Promise { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/src/libs/subscribeToFullReconnect.ts b/src/libs/subscribeToFullReconnect.ts index 47d143909614..ca80ca507a44 100644 --- a/src/libs/subscribeToFullReconnect.ts +++ b/src/libs/subscribeToFullReconnect.ts @@ -26,7 +26,7 @@ Onyx.connectWithoutView({ const connection = Onyx.connectWithoutView({ key: ONYXKEYS.LAST_FULL_RECONNECT_TIME, callback: (lastFullReconnectTimeOnyxValue) => { - Onyx.disconnect(connection); + connection.unsubscribe(); lastFullReconnectTime = lastFullReconnectTimeOnyxValue ?? ''; doFullReconnectIfNecessary(); }, diff --git a/src/libs/telemetry/crashDiagnostics/index.ts b/src/libs/telemetry/crashDiagnostics/index.ts index a2ce5ab31516..ad489cda8c6f 100644 --- a/src/libs/telemetry/crashDiagnostics/index.ts +++ b/src/libs/telemetry/crashDiagnostics/index.ts @@ -532,7 +532,7 @@ function cleanupCrashDiagnostics() { livenessChannel = undefined; } if (reportsConnection) { - Onyx.disconnect(reportsConnection); + reportsConnection.unsubscribe(); reportsConnection = undefined; } if (typeof window !== 'undefined') { diff --git a/src/setup/backgroundLocationTrackingTask/index.native.ts b/src/setup/backgroundLocationTrackingTask/index.native.ts index fa6662d6f63c..74f0c6619f13 100644 --- a/src/setup/backgroundLocationTrackingTask/index.native.ts +++ b/src/setup/backgroundLocationTrackingTask/index.native.ts @@ -24,7 +24,7 @@ function getGpsDraftDetails(): Promise> { const connection = Onyx.connectWithoutView({ key: ONYXKEYS.GPS_DRAFT_DETAILS, callback: (gpsDraftDetails: OnyxEntry) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(gpsDraftDetails); }, }); diff --git a/tests/actions/AttachmentTest.ts b/tests/actions/AttachmentTest.ts index 5fcb057ba780..896ba7a90561 100644 --- a/tests/actions/AttachmentTest.ts +++ b/tests/actions/AttachmentTest.ts @@ -94,7 +94,7 @@ describe('AttachmentStorage', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.ATTACHMENT, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -184,7 +184,7 @@ describe('AttachmentStorage', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.ATTACHMENT, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/actions/BetaOverridesTest.ts b/tests/actions/BetaOverridesTest.ts index 66a71c9ca6e0..32f7e7099556 100644 --- a/tests/actions/BetaOverridesTest.ts +++ b/tests/actions/BetaOverridesTest.ts @@ -13,7 +13,7 @@ function getBetaOverrides(): Promise { const connection = Onyx.connect({ key: ONYXKEYS.BETA_OVERRIDES, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/actions/ClearOnyxAndSeedFullReconnectTest.ts b/tests/actions/ClearOnyxAndSeedFullReconnectTest.ts index 269ef7bff55f..94300d4bc2ad 100644 --- a/tests/actions/ClearOnyxAndSeedFullReconnectTest.ts +++ b/tests/actions/ClearOnyxAndSeedFullReconnectTest.ts @@ -36,7 +36,7 @@ describe('actions/clearOnyxAndSeedFullReconnect', () => { expect(typeof value).toBe('string'); expect((value ?? '').length > 0).toBe(true); expect((value ?? '') >= before).toBe(true); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -58,7 +58,7 @@ describe('actions/clearOnyxAndSeedFullReconnect', () => { key: ONYXKEYS.SESSION, callback: (value) => { expect(value?.authToken).toBe('preserved-auth-token'); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -69,7 +69,7 @@ describe('actions/clearOnyxAndSeedFullReconnect', () => { key: ONYXKEYS.NVP_PRIORITY_MODE, callback: (value) => { expect(value).toBeUndefined(); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -91,7 +91,7 @@ describe('actions/clearOnyxAndSeedFullReconnect', () => { key: ONYXKEYS.IS_LOADING_APP, callback: (value) => { expect(value).toBe(true); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -103,7 +103,7 @@ describe('actions/clearOnyxAndSeedFullReconnect', () => { callback: (value) => { expect(typeof value).toBe('string'); expect((value ?? '').length > 0).toBe(true); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -124,7 +124,7 @@ describe('actions/clearOnyxAndSeedFullReconnect', () => { key: ONYXKEYS.IS_LOADING_APP, callback: (value) => { expect(value).toBe(false); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -144,7 +144,7 @@ describe('actions/clearOnyxAndSeedFullReconnect', () => { callback: (value) => { expect(typeof value).toBe('string'); expect((value ?? '').length > 0).toBe(true); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -169,7 +169,7 @@ describe('actions/clearOnyxAndSeedFullReconnect', () => { key: ONYXKEYS.NVP_PRIORITY_MODE, callback: (value) => { expect(value).toBeUndefined(); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -180,7 +180,7 @@ describe('actions/clearOnyxAndSeedFullReconnect', () => { key: ONYXKEYS.HAS_LOADED_APP, callback: (value) => { expect(value).toBeUndefined(); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -191,7 +191,7 @@ describe('actions/clearOnyxAndSeedFullReconnect', () => { key: ONYXKEYS.SESSION, callback: (value) => { expect(value?.authToken).toBe('preserved-auth-token'); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -202,7 +202,7 @@ describe('actions/clearOnyxAndSeedFullReconnect', () => { key: ONYXKEYS.IS_LOADING_APP, callback: (value) => { expect(value).toBe(true); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); diff --git a/tests/actions/CompanyCardsAssignTest.ts b/tests/actions/CompanyCardsAssignTest.ts index 27a924611ed7..95c8f87d7237 100644 --- a/tests/actions/CompanyCardsAssignTest.ts +++ b/tests/actions/CompanyCardsAssignTest.ts @@ -32,7 +32,7 @@ function getAssignCard() { const connection = Onyx.connect({ key: ONYXKEYS.ASSIGN_CARD, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/actions/DelegateTest.ts b/tests/actions/DelegateTest.ts index ce4480619759..937e86c1797c 100644 --- a/tests/actions/DelegateTest.ts +++ b/tests/actions/DelegateTest.ts @@ -67,7 +67,7 @@ describe('actions/Delegate', () => { callback: (account) => { // @ts-expect-error - errorFields is not defined in the type expect(account?.delegatedAccess?.delegators?.at(0)?.errorFields).toBeDefined(); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -82,7 +82,7 @@ describe('actions/Delegate', () => { callback: (account) => { // @ts-expect-error - errorFields is not defined in the type expect(account?.delegatedAccess?.delegators?.at(0)?.errorFields).toBeUndefined(); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -105,7 +105,7 @@ describe('actions/Delegate', () => { callback: (account) => { expect(account?.delegatedAccess?.delegates?.at(0)?.email).toBe('test@test.com'); expect(account?.delegatedAccess?.delegates?.at(0)?.role).toBe(CONST.DELEGATE_ROLE.ALL); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -165,7 +165,7 @@ describe('actions/Delegate', () => { key: ONYXKEYS.ACCOUNT, callback: (account) => { expect(account?.delegatedAccess?.delegates?.at(0)?.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -214,7 +214,7 @@ describe('actions/Delegate', () => { // The targeted errors should be cleared expect(errorFields?.addDelegate?.['test@test.com']).toBeUndefined(); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -248,7 +248,7 @@ describe('actions/Delegate', () => { const firstDelegate = account?.delegatedAccess?.delegates?.at(0); expect(firstDelegate?.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); expect(firstDelegate?.pendingFields?.role).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -276,7 +276,7 @@ describe('actions/Delegate', () => { key: ONYXKEYS.ACCOUNT, callback: (account) => { expect(isConnectedAsDelegate({delegatedAccess: account?.delegatedAccess})).toBe(false); - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -438,7 +438,7 @@ describe('actions/Delegate', () => { key: ONYXKEYS.IS_LOADING_APP, callback: (value) => { expect(value).toBe(true); - Onyx.disconnect(conn); + conn.unsubscribe(); resolve(); }, }); @@ -450,7 +450,7 @@ describe('actions/Delegate', () => { key: ONYXKEYS.HAS_LOADED_APP, callback: (value) => { expect(value).toBe(true); - Onyx.disconnect(conn); + conn.unsubscribe(); resolve(); }, }); @@ -462,7 +462,7 @@ describe('actions/Delegate', () => { key: ONYXKEYS.NVP_PRIORITY_MODE, callback: (value) => { expect(value).toBeUndefined(); - Onyx.disconnect(conn); + conn.unsubscribe(); resolve(); }, }); @@ -489,7 +489,7 @@ describe('actions/Delegate', () => { expect(typeof value).toBe('string'); expect(value && value.length > 0).toBe(true); expect((value ?? '') >= before).toBe(true); - Onyx.disconnect(conn); + conn.unsubscribe(); resolve(); }, }); @@ -501,7 +501,7 @@ describe('actions/Delegate', () => { key: ONYXKEYS.NVP_PRIORITY_MODE, callback: (value) => { expect(value).toBeUndefined(); - Onyx.disconnect(conn); + conn.unsubscribe(); resolve(); }, }); diff --git a/tests/actions/EarlyRenewalOfferTest.ts b/tests/actions/EarlyRenewalOfferTest.ts index 8cbdb77b164b..3331929eb704 100644 --- a/tests/actions/EarlyRenewalOfferTest.ts +++ b/tests/actions/EarlyRenewalOfferTest.ts @@ -51,7 +51,7 @@ describe('actions/EarlyRenewalOffer', () => { let eligibility: unknown; const connection = Onyx.connectWithoutView({key: ONYXKEYS.EARLY_RENEWAL_OFFER_ELIGIBILITY, callback: (value) => (eligibility = value)}); await waitForBatchedUpdates(); - Onyx.disconnect(connection); + connection.unsubscribe(); expect(eligibility).toEqual({canClaim: true}); }); }); diff --git a/tests/actions/IOU/MoneyRequestSettersTest.ts b/tests/actions/IOU/MoneyRequestSettersTest.ts index 38ef977684a5..87de60b98fba 100644 --- a/tests/actions/IOU/MoneyRequestSettersTest.ts +++ b/tests/actions/IOU/MoneyRequestSettersTest.ts @@ -350,7 +350,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(transaction?.taxCode).toBe(ruleTaxCode); expect(transaction?.taxAmount).toBe(5); resolve(); @@ -391,7 +391,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(transaction?.taxCode).toBe(taxCode); expect(transaction?.taxAmount).toBe(taxAmount); resolve(); @@ -429,7 +429,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(transaction?.taxCode).toBe(taxCode); expect(transaction?.taxAmount).toBe(taxAmount); resolve(); @@ -459,7 +459,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(transaction?.taxCode).toBe(''); expect(transaction?.taxAmount).toBeUndefined(); resolve(); diff --git a/tests/actions/IOU/PerDiemTest.ts b/tests/actions/IOU/PerDiemTest.ts index d317b87a0349..0d7bc1fdac58 100644 --- a/tests/actions/IOU/PerDiemTest.ts +++ b/tests/actions/IOU/PerDiemTest.ts @@ -1147,7 +1147,7 @@ describe('PerDiem', () => { key: `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS}${policyID}`, callback: (recentlyUsedTags) => { resolve(recentlyUsedTags ?? {}); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -1234,7 +1234,7 @@ describe('PerDiem', () => { key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (val) => { resolve(val ?? {}); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -1412,7 +1412,7 @@ describe('PerDiem', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/actions/IOU/RequestMoneyTest.ts b/tests/actions/IOU/RequestMoneyTest.ts index df676a91ae2f..fff114b3b231 100644 --- a/tests/actions/IOU/RequestMoneyTest.ts +++ b/tests/actions/IOU/RequestMoneyTest.ts @@ -241,7 +241,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // A chat report, a transaction thread, and an iou report should be created const chatReports = Object.values(allReports ?? {}).filter((report) => report?.type === CONST.REPORT.TYPE.CHAT); @@ -274,13 +274,13 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${iouReportID}`, callback: (iouReportMetadata) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(iouReportMetadata?.isOptimisticReport).toBe(true); const loadingStateConnection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.RAM_ONLY_REPORT_LOADING_STATE}${iouReportID}`, callback: (iouReportLoadingState) => { - Onyx.disconnect(loadingStateConnection); + loadingStateConnection.unsubscribe(); expect(iouReportLoadingState?.hasOnceLoadedReportActions).toBe(true); resolve(); }, @@ -295,7 +295,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportID}`, callback: (reportActionsForIOUReport) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // The IOU report should have a CREATED action and IOU action expect(Object.values(reportActionsForIOUReport ?? {}).length).toBe(2); @@ -341,7 +341,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThread?.reportID}`, callback: (reportActionsForTransactionThread) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // The transaction thread should have a CREATED action expect(Object.values(reportActionsForTransactionThread ?? {}).length).toBe(1); @@ -363,7 +363,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (allTransactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // There should be one transaction expect(Object.values(allTransactions ?? {}).length).toBe(1); @@ -398,7 +398,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.SNAPSHOT, callback: (snapshotData) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // Snapshot data shouldn't be updated optimistically for requestMoney when the current search query type is invoice. // Onyx resolves a registered collection with no members to the frozen `{}` once init has run. @@ -415,7 +415,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportID}`, callback: (reportActionsForIOUReport) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(Object.values(reportActionsForIOUReport ?? {}).length).toBe(2); for (const reportAction of Object.values(reportActionsForIOUReport ?? {})) { expect(reportAction?.pendingAction).toBeFalsy(); @@ -431,7 +431,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(transaction?.pendingAction).toBeFalsy(); resolve(); }, @@ -507,7 +507,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // The same chat report should be reused, a transaction thread and an IOU report should be created expect(Object.values(allReports ?? {}).length).toBe(3); @@ -535,7 +535,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportID}`, callback: (allIOUReportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); iouCreatedAction = Object.values(allIOUReportActions ?? {}).find((reportAction) => reportAction.actionName === CONST.REPORT.ACTIONS.TYPE.CREATED); iouAction = Object.values(allIOUReportActions ?? {}).find((reportAction): reportAction is ReportAction => @@ -572,7 +572,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (allTransactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // There should be one transaction expect(Object.values(allTransactions ?? {}).length).toBe(1); @@ -610,7 +610,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportID}`, callback: (reportActionsForIOUReport) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(Object.values(reportActionsForIOUReport ?? {}).length).toBe(2); for (const reportAction of Object.values(reportActionsForIOUReport ?? {})) { expect(reportAction?.pendingAction).toBeFalsy(); @@ -626,7 +626,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(transaction?.pendingAction).toBeFalsy(); resolve(); }, @@ -743,7 +743,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // No new reports should be created expect(Object.values(allReports ?? {}).length).toBe(3); @@ -767,7 +767,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportID}`, callback: (reportActionsForIOUReport) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(Object.values(reportActionsForIOUReport ?? {}).length).toBe(3); newIOUAction = Object.values(reportActionsForIOUReport ?? {}).find( @@ -803,7 +803,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (allTransactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // There should be two transactions expect(Object.values(allTransactions ?? {}).length).toBe(2); @@ -832,7 +832,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportID}`, callback: (reportActionsForIOUReport) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(Object.values(reportActionsForIOUReport ?? {}).length).toBe(3); for (const reportAction of Object.values(reportActionsForIOUReport ?? {})) { expect(reportAction?.pendingAction).toBeFalsy(); @@ -848,7 +848,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (allTransactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); for (const transaction of Object.values(allTransactions ?? {})) { expect(transaction?.pendingAction).toBeFalsy(); } @@ -912,7 +912,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // A chat report, transaction thread and an iou report should be created const chatReports = Object.values(allReports ?? {}).filter((report) => report?.type === CONST.REPORT.TYPE.CHAT); @@ -943,7 +943,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportID}`, callback: (reportActionsForIOUReport) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // The chat report should have a CREATED action and IOU action expect(Object.values(reportActionsForIOUReport ?? {}).length).toBe(2); @@ -989,7 +989,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (allTransactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // There should be one transaction expect(Object.values(allTransactions ?? {}).length).toBe(1); @@ -1020,7 +1020,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportID}`, callback: (reportActionsForIOUReport) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(Object.values(reportActionsForIOUReport ?? {}).length).toBe(2); iouAction = Object.values(reportActionsForIOUReport ?? {}).find((reportAction): reportAction is ReportAction => isMoneyRequestAction(reportAction), @@ -1037,7 +1037,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (reportActionsForTransactionThread) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(Object.values(reportActionsForTransactionThread ?? {}).length).toBe(3); transactionThreadAction = Object.values( reportActionsForTransactionThread?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReport?.reportID}`] ?? {}, @@ -1054,7 +1054,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(transaction?.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); expect(transaction?.errors).toBeTruthy(); expect(Object.values(transaction?.errors ?? {}).at(0)).toEqual(translateLocal('iou.error.genericCreateFailureMessage')); @@ -1082,7 +1082,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReportID}`, callback: (reportActionsForReport) => { - Onyx.disconnect(connection); + connection.unsubscribe(); iouAction = Object.values(reportActionsForReport ?? {}).find((reportAction): reportAction is ReportAction => isMoneyRequestAction(reportAction), ); @@ -1100,7 +1100,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReportID}`, callback: (reportActionsForReport) => { - Onyx.disconnect(connection); + connection.unsubscribe(); iouAction = Object.values(reportActionsForReport ?? {}).find((reportAction): reportAction is ReportAction => isMoneyRequestAction(reportAction), ); @@ -1118,7 +1118,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReport?.reportID}`, callback: (reportActionsForReport) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(reportActionsForReport).toMatchObject({}); resolve(); }, @@ -1133,7 +1133,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(transaction).toBeFalsy(); resolve(); }, @@ -1162,7 +1162,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); for (const report of Object.values(allReports ?? {})) { expect(report).toBeFalsy(); } @@ -1179,7 +1179,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (allReportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); for (const reportAction of Object.values(allReportActions ?? {})) { expect(reportAction).toBeFalsy(); } @@ -1196,7 +1196,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (allTransactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); for (const transaction of Object.values(allTransactions ?? {})) { expect(transaction).toBeFalsy(); } @@ -1575,7 +1575,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report?.nonReimbursableTotal ?? 0); }, }); @@ -1625,7 +1625,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport?.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report?.nonReimbursableTotal ?? 0); }, }); @@ -1766,7 +1766,7 @@ describe('actions/IOU', () => { key: `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS}${policyID}`, callback: (recentlyUsedTags) => { resolve(recentlyUsedTags ?? {}); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -2035,7 +2035,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reports); }, }); @@ -2057,7 +2057,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -2076,7 +2076,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (transactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transactions); }, }); @@ -2136,7 +2136,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reports?.[`${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReport?.reportID}`]); }, }); @@ -2214,7 +2214,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // A NEW chat report should be created for RORY and CARLOS // The existing chat report between RORY and JULES should still exist @@ -2306,7 +2306,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // The existing chat report should be reused const chatReports = Object.values(allReports ?? {}).filter((report) => report?.type === CONST.REPORT.TYPE.CHAT); @@ -2389,7 +2389,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // The policy expense chat report should be reused (participant validation skipped) const policyExpenseChats = Object.values(allReports ?? {}).filter((report) => report?.chatType === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT); @@ -2467,7 +2467,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // Even though participants don't match (JULES vs CARLOS), // since the chatReport is a policy expense chat, it should be reused @@ -2546,7 +2546,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // The self-DM report should be reused (participant validation should be skipped) // No new 1:1 DM chat with accountID 0 should be created diff --git a/tests/actions/IOU/SplitReportTotalsTest.ts b/tests/actions/IOU/SplitReportTotalsTest.ts index 81f26b8ef4f9..98d3790c5a91 100644 --- a/tests/actions/IOU/SplitReportTotalsTest.ts +++ b/tests/actions/IOU/SplitReportTotalsTest.ts @@ -750,7 +750,7 @@ describe('actions/IOU', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${reportID}`, callback: (metadata) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(metadata?.pendingNewTransactionIDs); }, }); diff --git a/tests/actions/IOUTest/DeleteMoneyRequestTest.ts b/tests/actions/IOUTest/DeleteMoneyRequestTest.ts index d68c0b6d5ab6..594c6fa570bb 100644 --- a/tests/actions/IOUTest/DeleteMoneyRequestTest.ts +++ b/tests/actions/IOUTest/DeleteMoneyRequestTest.ts @@ -187,7 +187,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reports); }, }); @@ -223,7 +223,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -291,7 +291,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport?.reportID}`, callback: (actionsForReport) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actionsForReport); }, }); @@ -308,7 +308,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction?.transactionID}`, callback: (transactionResult) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transactionResult); }, }); @@ -326,7 +326,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport?.reportID}`, callback: (actionsForReport) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actionsForReport); }, }); @@ -342,7 +342,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction?.transactionID}`, callback: (transactionResult) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transactionResult); }, }); @@ -380,7 +380,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport?.reportID}`, callback: (res) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(res); }, }); @@ -397,7 +397,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport?.reportID}`, callback: (res) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(res); }, }); @@ -471,7 +471,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reports); }, }); @@ -491,7 +491,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reports); }, }); @@ -548,7 +548,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -590,7 +590,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${thread.reportID}`, callback: (reportData) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reportData); }, }); @@ -604,7 +604,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${thread.reportID}`, callback: (reportData) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reportData); }, }); @@ -657,7 +657,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -718,7 +718,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport?.reportID}`, callback: (reportActionsForReport) => { - Onyx.disconnect(connection); + connection.unsubscribe(); createIOUAction = Object.values(reportActionsForReport ?? {}).find((reportAction): reportAction is ReportAction => isMoneyRequestAction(reportAction), ); @@ -752,7 +752,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${thread.reportID}`, callback: (reportData) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reportData); }, }); @@ -800,7 +800,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${thread.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report).toBeTruthy(); resolve(); }, @@ -841,7 +841,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -877,7 +877,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${thread.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report?.reportID).toBeFalsy(); resolve(); }, @@ -894,7 +894,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${thread.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report).toBeFalsy(); resolve(); }, @@ -943,7 +943,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -979,7 +979,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport?.reportID}`, callback: (reportActionsForReport) => { - Onyx.disconnect(connection); + connection.unsubscribe(); createIOUAction = Object.values(reportActionsForReport ?? {}).find((reportAction): reportAction is ReportAction => isMoneyRequestAction(reportAction), ); @@ -1076,7 +1076,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport?.reportID}`, callback: (reportActionsForReport) => { - Onyx.disconnect(connection); + connection.unsubscribe(); createIOUAction = Object.values(reportActionsForReport ?? {}).find((reportAction): reportAction is ReportAction => isMoneyRequestAction(reportAction), ); @@ -1095,7 +1095,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport?.reportID}`, callback: (reportActionsForReport) => { - Onyx.disconnect(connection); + connection.unsubscribe(); createIOUAction = Object.values(reportActionsForReport ?? {}).find((reportAction): reportAction is ReportAction => isMoneyRequestAction(reportAction), ); @@ -1275,7 +1275,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -1314,7 +1314,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reports); }, }); @@ -1331,7 +1331,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reports); }, }); @@ -1472,7 +1472,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${thread.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report).toBeTruthy(); resolve(); }, @@ -1511,7 +1511,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -1669,7 +1669,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -1832,7 +1832,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction1.transactionID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -1900,7 +1900,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction1.transactionID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -2047,7 +2047,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -2075,7 +2075,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -2126,7 +2126,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -2172,7 +2172,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -2226,7 +2226,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -2276,7 +2276,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -2309,7 +2309,7 @@ describe('actions/IOU/DeleteMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); diff --git a/tests/actions/IOUTest/DuplicateTest.ts b/tests/actions/IOUTest/DuplicateTest.ts index 3b4a67b07911..57456f464598 100644 --- a/tests/actions/IOUTest/DuplicateTest.ts +++ b/tests/actions/IOUTest/DuplicateTest.ts @@ -766,7 +766,7 @@ describe('actions/Duplicate', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReport1.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report).toBeTruthy(); resolve(); }, @@ -776,7 +776,7 @@ describe('actions/Duplicate', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReport2.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report).toBeTruthy(); resolve(); }, @@ -877,7 +877,7 @@ describe('actions/Duplicate', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReport1.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report?.reportID).toBeFalsy(); resolve(); }, @@ -888,7 +888,7 @@ describe('actions/Duplicate', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThreadReport2.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report?.reportID).toBeFalsy(); resolve(); }, @@ -3155,7 +3155,7 @@ describe('actions/Duplicate', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction2.transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // Then the duplicate transaction should correctly be set on hold. expect(transaction?.comment?.hold).toBeDefined(); resolve(); diff --git a/tests/actions/IOUTest/HoldTest.ts b/tests/actions/IOUTest/HoldTest.ts index 12e67b7863bd..b19b2c2e7845 100644 --- a/tests/actions/IOUTest/HoldTest.ts +++ b/tests/actions/IOUTest/HoldTest.ts @@ -242,12 +242,12 @@ describe('actions/IOU/Hold', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThread.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const lastVisibleActionCreated = report?.lastVisibleActionCreated; const connection2 = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThread.reportID}`, callback: (reportActions) => { - Onyx.disconnect(connection2); + connection2.unsubscribe(); resolve(); const lastAction = getSortedReportActions(Object.values(reportActions ?? {}), true).at(0); const message = getReportActionMessage(lastAction); @@ -318,7 +318,7 @@ describe('actions/IOU/Hold', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.reportID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const updatedIOUAction = reportActions?.[iouAction.reportActionID]; // Verify that IOU action now has childReportID set optimistically expect(updatedIOUAction?.childReportID).toBeDefined(); @@ -423,7 +423,7 @@ describe('actions/IOU/Hold', () => { const connection1 = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction1.transactionID}`, callback: (updatedTransaction1) => { - Onyx.disconnect(connection1); + connection1.unsubscribe(); // Both transactions should have pending hold action set expect(updatedTransaction1?.comment?.hold).toBeDefined(); checkBothTransactions(); @@ -432,7 +432,7 @@ describe('actions/IOU/Hold', () => { const connection2 = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction2.transactionID}`, callback: (updatedTransaction2) => { - Onyx.disconnect(connection2); + connection2.unsubscribe(); expect(updatedTransaction2?.comment?.hold).toBeDefined(); checkBothTransactions(); }, @@ -755,7 +755,7 @@ describe('actions/IOU/Hold', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reportActions); }, }); @@ -897,12 +897,12 @@ describe('actions/IOU/Hold', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${transactionThread.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const lastVisibleActionCreated = report?.lastVisibleActionCreated; const connection2 = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThread.reportID}`, callback: (reportActions) => { - Onyx.disconnect(connection2); + connection2.unsubscribe(); resolve(); const lastAction = getSortedReportActions(Object.values(reportActions ?? {}), true).at(0); // Then the transaction thread report lastVisibleActionCreated should equal the unhold action created timestamp. diff --git a/tests/actions/IOUTest/PayMoneyRequestTest.ts b/tests/actions/IOUTest/PayMoneyRequestTest.ts index 608421b8431b..41f0e3a7413d 100644 --- a/tests/actions/IOUTest/PayMoneyRequestTest.ts +++ b/tests/actions/IOUTest/PayMoneyRequestTest.ts @@ -184,7 +184,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(Object.values(allReports ?? {}).length).toBe(3); @@ -216,7 +216,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (allReportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const reportActionsForIOUReport = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReport?.iouReportID}`]; @@ -237,7 +237,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (allTransactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(Object.values(allTransactions ?? {}).length).toBe(1); transaction = Object.values(allTransactions ?? {}).find((t) => t); expect(transaction).toBeTruthy(); @@ -285,7 +285,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(Object.values(allReports ?? {}).length).toBe(3); @@ -308,7 +308,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (allReportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const reportActionsForIOUReport = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport?.reportID}`]; expect(Object.values(reportActionsForIOUReport ?? {}).length).toBe(3); @@ -331,7 +331,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(Object.values(allReports ?? {}).length).toBe(3); @@ -354,7 +354,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (allReportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const reportActionsForIOUReport = allReportActions?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport?.reportID}`]; expect(Object.values(reportActionsForIOUReport ?? {}).length).toBe(3); @@ -416,7 +416,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); chatReport = Object.values(allReports ?? {}).find((report) => report?.chatType === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT); resolve(); @@ -471,7 +471,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expenseReport = Object.values(allReports ?? {}).find((report) => report?.type === CONST.REPORT.TYPE.IOU); resolve(); @@ -514,7 +514,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport?.reportID}`, callback: (allActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(Object.values(allActions ?? {})).toEqual( expect.arrayContaining([ expect.objectContaining({ @@ -543,7 +543,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const updatedIOUReport = Object.values(allReports ?? {}).find((report) => report?.type === CONST.REPORT.TYPE.IOU); const updatedChatReport = Object.values(allReports ?? {}).find((report) => report?.reportID === expenseReport?.chatReportID); expect(updatedIOUReport).toEqual( @@ -600,7 +600,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); chatReport = Object.values(allReports ?? {}).find((report) => report?.chatType === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT); resolve(); @@ -655,7 +655,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expenseReport = Object.values(allReports ?? {}).find((report) => report?.type === CONST.REPORT.TYPE.IOU); resolve(); @@ -699,7 +699,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport?.reportID}`, callback: (allActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const erroredAction = Object.values(allActions ?? {}).find((action) => !isEmptyObject(action?.errors)); expect(Object.values(erroredAction?.errors ?? {}).at(0)).toEqual(translateLocal('iou.error.other')); resolve(); @@ -760,7 +760,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.reportID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(Object.values(reportActions ?? {}).pop()); }, }); @@ -770,7 +770,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report?.lastVisibleActionCreated).toBe(chatReport.lastVisibleActionCreated); expect(report?.hasOutstandingChildRequest).toBe(false); expect(report?.iouReportID).toBeUndefined(); @@ -786,7 +786,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report?.hasOutstandingChildRequest).toBe(false); expect(report?.statusNum).toBe(CONST.REPORT.STATUS_NUM.REIMBURSED); expect(report?.lastVisibleActionCreated).toBe(payReportAction?.created); @@ -911,7 +911,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.reportID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(Object.values(reportActions ?? {}).pop()); }, }); @@ -969,7 +969,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.reportID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(Object.values(reportActions ?? {}).pop()); }, }); @@ -1395,7 +1395,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report?.hasOutstandingChildRequest).toBe(false); expect(report?.statusNum).toBe(CONST.REPORT.STATUS_NUM.REIMBURSED); resolve(); @@ -1453,7 +1453,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report?.hasOutstandingChildRequest).toBe(false); expect(report?.statusNum).toBe(CONST.REPORT.STATUS_NUM.REIMBURSED); resolve(); @@ -1551,7 +1551,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1821,7 +1821,7 @@ describe('actions/IOU/PayMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report?.hasOutstandingChildRequest).toBe(false); expect(report?.statusNum).toBe(CONST.REPORT.STATUS_NUM.REIMBURSED); resolve(); diff --git a/tests/actions/IOUTest/ReceiptTest.ts b/tests/actions/IOUTest/ReceiptTest.ts index be5480757164..6c8c5015967e 100644 --- a/tests/actions/IOUTest/ReceiptTest.ts +++ b/tests/actions/IOUTest/ReceiptTest.ts @@ -126,7 +126,7 @@ describe('actions/IOU/Receipt', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (transactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transactions[`${ONYXKEYS.COLLECTION.TRANSACTION}${id}`]); }, }); diff --git a/tests/actions/IOUTest/ReportWorkflowTest.ts b/tests/actions/IOUTest/ReportWorkflowTest.ts index 381819258dee..f8b2b79050c4 100644 --- a/tests/actions/IOUTest/ReportWorkflowTest.ts +++ b/tests/actions/IOUTest/ReportWorkflowTest.ts @@ -199,7 +199,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); chatReport = Object.values(allReports ?? {}).find((report) => report?.chatType === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT); resolve(); @@ -256,7 +256,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expenseReport = Object.values(allReports ?? {}).find((report) => report?.type === CONST.REPORT.TYPE.EXPENSE); Onyx.merge(`report_${expenseReport?.reportID}`, { statusNum: 0, @@ -273,7 +273,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expenseReport = Object.values(allReports ?? {}).find((report) => report?.type === CONST.REPORT.TYPE.EXPENSE); // Verify report is a draft @@ -315,7 +315,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expenseReport = Object.values(allReports ?? {}).find((report) => report?.type === CONST.REPORT.TYPE.EXPENSE); // Report was submitted correctly expect(expenseReport?.stateNum).toBe(1); @@ -923,7 +923,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); chatReport = Object.values(allReports ?? {}).find((report) => report?.chatType === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT); resolve(); @@ -1018,7 +1018,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); chatReport = Object.values(allReports ?? {}).find((report) => report?.chatType === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT); resolve(); }, @@ -1075,7 +1075,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); chatReport = Object.values(allReports ?? {}).find((report) => report?.chatType === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT); resolve(); }, @@ -1132,7 +1132,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.POLICY, callback: (allPolicies) => { - Onyx.disconnect(connection); + connection.unsubscribe(); policy = Object.values(allPolicies ?? {}).find((p): p is OnyxEntry => p?.name === "Carlos's Workspace"); expect(policy).toBeTruthy(); resolve(); @@ -1146,7 +1146,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expenseReport = Object.values(allReports ?? {}).find((report) => report?.type === CONST.REPORT.TYPE.EXPENSE); Onyx.merge(`report_${expenseReport?.reportID}`, { @@ -1176,7 +1176,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expenseReport = Object.values(allReports ?? {}).find((report) => report?.type === CONST.REPORT.TYPE.EXPENSE); resolve(); @@ -1221,7 +1221,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expenseReport = Object.values(allReports ?? {}).find((report) => report?.type === CONST.REPORT.TYPE.EXPENSE); resolve(); @@ -1281,7 +1281,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.POLICY, callback: (allPolicies) => { - Onyx.disconnect(connection); + connection.unsubscribe(); policy = Object.values(allPolicies ?? {}).find((p): p is OnyxEntry => p?.id === policy?.id); resolve(); }, @@ -1294,7 +1294,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); chatReport = Object.values(allReports ?? {}).find((report) => report?.chatType === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT); expect(canIOUBePaid(expenseReport, chatReport, policy, {}, CARLOS_EMAIL, CARLOS_ACCOUNT_ID, [], true, false)).toBe(false); @@ -1345,7 +1345,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); chatReport = Object.values(allReports ?? {}).find((report) => report?.chatType === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT); resolve(); }, @@ -1402,7 +1402,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); chatReport = Object.values(allReports ?? {}).find((report) => report?.chatType === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT); resolve(); }, @@ -1459,7 +1459,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.POLICY, callback: (allPolicies) => { - Onyx.disconnect(connection); + connection.unsubscribe(); policy = Object.values(allPolicies ?? {}).find((p): p is OnyxEntry => p?.name === "Carlos's Workspace"); expect(policy).toBeTruthy(); resolve(); @@ -1473,7 +1473,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expenseReport = Object.values(allReports ?? {}).find((report) => report?.type === CONST.REPORT.TYPE.EXPENSE); Onyx.merge(`report_${expenseReport?.reportID}`, { @@ -1503,7 +1503,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expenseReport = Object.values(allReports ?? {}).find((report) => report?.type === CONST.REPORT.TYPE.EXPENSE); // Verify report is a draft @@ -1546,7 +1546,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expenseReport = Object.values(allReports ?? {}).find((report) => report?.type === CONST.REPORT.TYPE.EXPENSE); // Report was submitted with some fail @@ -1601,7 +1601,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.POLICY, callback: (allPolicies) => { - Onyx.disconnect(connection); + connection.unsubscribe(); policy = Object.values(allPolicies ?? {}).find((p): p is OnyxEntry => p?.id === policyID); expect(policy).toBeTruthy(); expect(policy?.approvalMode).toBe(CONST.POLICY.APPROVAL_MODE.DYNAMICEXTERNAL); @@ -1616,7 +1616,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); chatReport = Object.values(allReports ?? {}).find( (report) => report?.chatType === CONST.REPORT.CHAT_TYPE.POLICY_EXPENSE_CHAT && report.policyID === policyID, ); @@ -1675,7 +1675,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expenseReport = Object.values(allReports ?? {}).find((report) => report?.type === CONST.REPORT.TYPE.EXPENSE && report?.policyID === policyID); Onyx.merge(`report_${expenseReport?.reportID}`, { statusNum: 0, @@ -1692,7 +1692,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expenseReport = Object.values(allReports ?? {}).find((report) => report?.type === CONST.REPORT.TYPE.EXPENSE && report?.policyID === policyID); expect(expenseReport?.stateNum).toBe(0); @@ -1734,7 +1734,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expenseReport = Object.values(allReports ?? {}).find((report) => report?.type === CONST.REPORT.TYPE.EXPENSE && report?.policyID === policyID); expect(expenseReport?.stateNum).toBe(CONST.REPORT.STATE_NUM.OPEN); @@ -4513,7 +4513,7 @@ describe('actions/IOU/ReportWorkflow', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report?.iouReportID); }, }); diff --git a/tests/actions/IOUTest/SendInvoiceTest.ts b/tests/actions/IOUTest/SendInvoiceTest.ts index e2934888ee46..5f5ff14723c3 100644 --- a/tests/actions/IOUTest/SendInvoiceTest.ts +++ b/tests/actions/IOUTest/SendInvoiceTest.ts @@ -885,7 +885,7 @@ describe('actions/SendInvoice', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (allTransactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const transactionValue = Object.values(allTransactions).at(0); expect(transactionValue?.errors).not.toBeUndefined(); expect(transactionValue?.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD); diff --git a/tests/actions/IOUTest/SplitTest.ts b/tests/actions/IOUTest/SplitTest.ts index 7e50ad882488..6bcb3f7ad3d8 100644 --- a/tests/actions/IOUTest/SplitTest.ts +++ b/tests/actions/IOUTest/SplitTest.ts @@ -444,7 +444,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // There should now be 10 reports expect(Object.values(allReports ?? {}).length).toBe(10); @@ -521,7 +521,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (allReportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // There should be reportActions on all 7 chat reports + 3 IOU reports in each 1:1 chat expect(Object.values(allReportActions ?? {}).length).toBe(10); @@ -607,7 +607,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (allTransactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); /* There should be 5 transactions * – one existing one with Jules @@ -672,7 +672,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: ONYXKEYS.PERSONAL_DETAILS_LIST, callback: (allPersonalDetails) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(allPersonalDetails).toMatchObject({ [VIT_ACCOUNT_ID]: { accountID: VIT_ACCOUNT_ID, @@ -693,7 +693,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (allReports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); for (const report of Object.values(allReports ?? {})) { if (!report?.pendingFields) { continue; @@ -713,7 +713,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (allReportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); for (const reportAction of Object.values(allReportActions ?? {})) { expect(reportAction?.pendingAction).toBeFalsy(); } @@ -728,7 +728,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (allTransactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); for (const transaction of Object.values(allTransactions ?? {})) { expect(transaction?.pendingAction).toBeFalsy(); } @@ -777,7 +777,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${workspaceReportID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(Object.values(reportActions ?? {}).find((action) => action.actionName === CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW)); }, }); @@ -787,7 +787,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${workspaceReportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report?.lastVisibleActionCreated).toBe(reportPreviewAction?.created); resolve(report); }, @@ -965,7 +965,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve( Object.values(reportActions ?? {}) .filter((action) => isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.IOU)) @@ -980,7 +980,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, callback: (reportVal) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reportVal); }, }); @@ -1035,7 +1035,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (transactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(Object.values(transactions ?? {}).find((transaction) => transaction?.amount === -(transactionAmount / 2))); }, }); @@ -1091,7 +1091,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, callback: (reportVal) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reportVal); }, }); @@ -1168,7 +1168,7 @@ describe('split expense', () => { key: `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS}${policyID}`, callback: (recentlyUsedTags) => { resolve(recentlyUsedTags ?? {}); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -1495,7 +1495,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (transactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const splits = Object.values(transactions ?? {}).filter((t) => t?.transactionID !== originalTransactionID && t?.comment?.originalTransactionID === originalTransactionID); resolve(splits.filter((split): split is Transaction => split != null)); }, @@ -1564,7 +1564,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1630,7 +1630,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reports); }, }); @@ -1643,7 +1643,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1701,7 +1701,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (transactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transactions); }, }); @@ -1715,7 +1715,7 @@ describe('split expense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -1968,7 +1968,7 @@ describe('startSplitBill', () => { key: `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS}${policyID}`, callback: (recentlyUsedTags) => { resolve(recentlyUsedTags ?? {}); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -2180,7 +2180,7 @@ describe('updateSplitTransactionsFromSplitExpensesFlow', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${iouAction.childReportID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -2306,7 +2306,7 @@ describe('updateSplitTransactionsFromSplitExpensesFlow', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${hash}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -2443,7 +2443,7 @@ describe('updateSplitTransactionsFromSplitExpensesFlow', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${unapprovedCashHash}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -2546,7 +2546,7 @@ describe('updateSplitTransactionsFromSplitExpensesFlow', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${groupHash}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -2919,7 +2919,7 @@ describe('updateSplitTransactionsFromSplitExpensesFlow', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${differentReportID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -10176,7 +10176,7 @@ describe('setDraftSplitTransaction', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(transaction?.taxCode).toBe(ruleTaxCode); expect(transaction?.taxAmount).toBe(5); resolve(); @@ -10217,7 +10217,7 @@ describe('setDraftSplitTransaction', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(transaction?.taxCode).toBe(taxCode); expect(transaction?.taxAmount).toBe(taxAmount); resolve(); @@ -10254,7 +10254,7 @@ describe('setDraftSplitTransaction', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(transaction?.taxCode).toBeUndefined(); expect(transaction?.taxAmount).toBeUndefined(); resolve(); diff --git a/tests/actions/IOUTest/TrackExpenseTest.ts b/tests/actions/IOUTest/TrackExpenseTest.ts index c1954547530e..176e03fa3c26 100644 --- a/tests/actions/IOUTest/TrackExpenseTest.ts +++ b/tests/actions/IOUTest/TrackExpenseTest.ts @@ -350,7 +350,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (transactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const trackedExpenseTransaction = Object.values(transactions ?? {}).at(0); // Then the transaction must remain a distance request @@ -366,7 +366,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reportActions); }, }); @@ -461,7 +461,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (transactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const categorizedTransaction = transactions?.[`${ONYXKEYS.COLLECTION.TRANSACTION}${transaction?.transactionID}`]; // Then the transaction must remain a distance request, ensuring that the optimistic data is correctly built and the transaction type remains accurate. @@ -482,7 +482,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: ONYXKEYS.NVP_QUICK_ACTION_GLOBAL_CREATE, callback: (quickAction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); // Then the quickAction.action should be set to REQUEST_DISTANCE @@ -555,7 +555,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${selfDMReport.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -616,7 +616,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${policyExpenseChat.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -625,7 +625,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policy.id}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -703,7 +703,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${selfDMReport.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -764,7 +764,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${policyExpenseChat.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -773,7 +773,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policy.id}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -855,7 +855,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${selfDMReport.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -916,7 +916,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policy.id}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1000,7 +1000,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${selfDMReport.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1065,7 +1065,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reports); }, }); @@ -1172,7 +1172,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${selfDMReport.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1234,7 +1234,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${accountantExpenseChatID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1243,7 +1243,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${archivedExpenseReportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1898,7 +1898,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -1921,7 +1921,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -2534,7 +2534,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reports); }, }); @@ -2562,7 +2562,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -2581,7 +2581,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (transactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transactions); }, }); @@ -2636,7 +2636,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${thread.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report).toBeTruthy(); resolve(); }, @@ -2675,7 +2675,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -2753,7 +2753,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${thread.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report).toBeTruthy(); resolve(); }, @@ -2915,7 +2915,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -2925,7 +2925,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -2935,7 +2935,7 @@ describe('actions/IOU/TrackExpense', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); diff --git a/tests/actions/IOUTest/UpdateMoneyRequestTest.ts b/tests/actions/IOUTest/UpdateMoneyRequestTest.ts index ef04c2a94672..09dcfa5861a3 100644 --- a/tests/actions/IOUTest/UpdateMoneyRequestTest.ts +++ b/tests/actions/IOUTest/UpdateMoneyRequestTest.ts @@ -218,7 +218,7 @@ describe('actions/IOU/UpdateMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(transaction?.taxCode).toBe(ruleTaxCode); expect(transaction?.taxAmount).toBe(5); resolve(); @@ -231,7 +231,7 @@ describe('actions/IOU/UpdateMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${transactionThreadReportID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const reportAction = Object.values(reportActions ?? {}).at(0); if (isActionOfType(reportAction, CONST.REPORT.ACTIONS.TYPE.MODIFIED_EXPENSE)) { const originalMessage = getOriginalMessage(reportAction); @@ -307,7 +307,7 @@ describe('actions/IOU/UpdateMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(transaction?.taxCode).toBe(taxCode); expect(transaction?.taxAmount).toBe(taxAmount); resolve(); @@ -362,7 +362,7 @@ describe('actions/IOU/UpdateMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(transaction?.taxCode).toBeUndefined(); expect(transaction?.taxAmount).toBeUndefined(); resolve(); @@ -428,7 +428,7 @@ describe('actions/IOU/UpdateMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`, callback: (transactionViolations) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(transactionViolations).toHaveLength(1); expect(transactionViolations?.at(0)?.name).toEqual(CONST.VIOLATIONS.MISSING_CATEGORY); resolve(); @@ -577,7 +577,7 @@ describe('actions/IOU/UpdateMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (transactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const newTransaction = transactions[`${ONYXKEYS.COLLECTION.TRANSACTION}${fakeTransaction.transactionID}`]; resolve(newTransaction); }, @@ -652,7 +652,7 @@ describe('actions/IOU/UpdateMoneyRequest', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.TRANSACTION, callback: (transactions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const newTransaction = transactions[`${ONYXKEYS.COLLECTION.TRANSACTION}${fakeTransaction.transactionID}`]; resolve(newTransaction); }, @@ -866,7 +866,7 @@ describe('actions/IOU/UpdateMoneyRequest', () => { const connection = Onyx.connectWithoutView({ key: ONYXKEYS.NVP_RECENT_ATTENDEES, callback: (attendees) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(attendees); }, }); @@ -906,7 +906,7 @@ describe('actions/IOU/UpdateMoneyRequest', () => { const connection = Onyx.connectWithoutView({ key: ONYXKEYS.NVP_RECENT_ATTENDEES, callback: (attendees) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(attendees); }, }); @@ -978,7 +978,7 @@ describe('actions/IOU/UpdateMoneyRequest', () => { key: `${ONYXKEYS.COLLECTION.POLICY_RECENTLY_USED_TAGS}${policy.id}`, callback: (recentlyUsedTags) => { resolve(recentlyUsedTags ?? {}); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -1044,7 +1044,7 @@ describe('actions/IOU/UpdateMoneyRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${transactionID}`, callback: (transactionViolations) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(transactionViolations?.some((violation) => violation.name === CONST.VIOLATIONS.TAG_OUT_OF_POLICY)).toBe(false); resolve(); }, diff --git a/tests/actions/MarketingAttributionTest.ts b/tests/actions/MarketingAttributionTest.ts index 3e721da69e8c..8e350d64e258 100644 --- a/tests/actions/MarketingAttributionTest.ts +++ b/tests/actions/MarketingAttributionTest.ts @@ -28,7 +28,7 @@ function getStoredAttribution(): Promise> const connection = Onyx.connect({ key: ONYXKEYS.MARKETING_ATTRIBUTION, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/actions/MergeTransactionTest.ts b/tests/actions/MergeTransactionTest.ts index 6425da1a5ade..406b81b4f89d 100644 --- a/tests/actions/MergeTransactionTest.ts +++ b/tests/actions/MergeTransactionTest.ts @@ -363,7 +363,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${targetTransaction.transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transaction ?? null); }, }); @@ -373,7 +373,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${sourceTransaction.transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transaction ?? null); }, }); @@ -383,7 +383,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${sourceExpenseReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report ?? null); }, }); @@ -393,7 +393,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.MERGE_TRANSACTION}${mergeTransactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transaction ?? null); }, }); @@ -491,7 +491,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${targetTransaction.transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transaction ?? null); }, }); @@ -626,7 +626,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${targetTransaction.transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transaction ?? null); }, }); @@ -636,7 +636,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${sourceTransaction.transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transaction ?? null); }, }); @@ -646,7 +646,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${targetExpenseReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report ?? null); }, }); @@ -656,7 +656,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${sourceExpenseReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report ?? null); }, }); @@ -766,7 +766,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${targetTransaction.transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transaction ?? null); }, }); @@ -776,7 +776,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${sourceTransaction.transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transaction ?? null); }, }); @@ -786,7 +786,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${sourceReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report ?? null); }, }); @@ -881,7 +881,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION_VIOLATIONS}${targetTransaction.transactionID}`, callback: (violations) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(violations ?? null); }, }); @@ -912,7 +912,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${targetReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report ?? null); }, }); @@ -925,7 +925,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${sourceExpenseReport.reportID}`, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions ?? null); }, }); @@ -950,7 +950,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${targetTransactionThreadID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report ?? null); }, }); @@ -977,7 +977,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${sourceExpenseReport.reportID}`, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions ?? null); }, }); @@ -989,7 +989,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${targetTransactionThreadID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report ?? null); }, }); @@ -1118,7 +1118,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${sourceReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report ?? null); }, }); @@ -1132,7 +1132,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReportID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val ?? null); }, }); @@ -1252,7 +1252,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${thread.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report).toBeTruthy(); resolve(); }, @@ -1335,7 +1335,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${thread.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report?.reportID).toBeFalsy(); resolve(); }, @@ -1357,7 +1357,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${thread.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report).toBeFalsy(); resolve(); }, @@ -1441,7 +1441,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${thread.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report).toBeTruthy(); resolve(); }, @@ -1490,7 +1490,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${thread.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report?.reportID).toBeFalsy(); resolve(); }, @@ -1506,7 +1506,7 @@ describe('mergeTransactionRequest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${thread.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report).toBeFalsy(); resolve(); }, @@ -2435,7 +2435,7 @@ describe('setupMergeTransactionData', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.MERGE_TRANSACTION}${transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transaction ?? null); }, }); @@ -2478,7 +2478,7 @@ describe('setMergeTransactionKey', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.MERGE_TRANSACTION}${transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transaction ?? null); }, }); diff --git a/tests/actions/PolicyCategoryTest.ts b/tests/actions/PolicyCategoryTest.ts index 2587abc3d0f8..4d57f2ecdac4 100644 --- a/tests/actions/PolicyCategoryTest.ts +++ b/tests/actions/PolicyCategoryTest.ts @@ -70,7 +70,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // Check if policy requiresCategory was updated with correct values expect(policy?.requiresCategory).toBeTruthy(); expect(policy?.pendingFields?.requiresCategory).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); @@ -85,7 +85,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // Check if the policy pendingFields was cleared expect(policy?.pendingFields?.requiresCategory).toBeFalsy(); resolve(); @@ -117,7 +117,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${fakePolicy.id}`, callback: (policyCategories) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const newCategory = policyCategories?.[newCategoryName]; expect(newCategory?.name).toBe(newCategoryName); @@ -133,7 +133,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${fakePolicy.id}`, callback: (policyCategories) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const newCategory = policyCategories?.[newCategoryName]; expect(newCategory?.errors).toBeFalsy(); @@ -169,7 +169,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${fakePolicy.id}`, callback: (policyCategories) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policyCategories?.[oldCategoryName ?? '']).toBeFalsy(); expect(policyCategories?.[newCategoryName]?.name).toBe(newCategoryName); @@ -186,7 +186,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${fakePolicy.id}`, callback: (policyCategories) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policyCategories?.[newCategoryName]?.pendingAction).toBeFalsy(); expect(policyCategories?.[newCategoryName]?.pendingFields?.name).toBeFalsy(); @@ -229,7 +229,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${fakePolicy.id}`, callback: (policyCategories) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policyCategories?.[categoryNameToUpdate]?.enabled).toBeTruthy(); expect(policyCategories?.[categoryNameToUpdate]?.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); @@ -245,7 +245,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${fakePolicy.id}`, callback: (policyCategories) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policyCategories?.[categoryNameToUpdate]?.pendingAction).toBeFalsy(); expect(policyCategories?.[categoryNameToUpdate]?.pendingFields?.enabled).toBeFalsy(); @@ -274,7 +274,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${fakePolicy.id}`, callback: (policyCategories) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policyCategories?.[categoryNameToDelete]?.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE); resolve(); @@ -287,7 +287,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${fakePolicy.id}`, callback: (policyCategories) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policyCategories?.[categoryNameToDelete]).toBeFalsy(); resolve(); @@ -326,7 +326,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.pendingFields?.areCategoriesEnabled).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); resolve(); }, @@ -336,7 +336,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${fakePolicy.id}`, callback: (policyCategories) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(Object.values(policyCategories ?? {}).every((category) => category.enabled === false)).toBeTruthy(); resolve(); }, @@ -349,7 +349,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.areCategoriesEnabled).toBe(false); expect(policy?.requiresCategory).toBe(false); expect(policy?.pendingFields?.areCategoriesEnabled).toBeFalsy(); @@ -387,7 +387,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.pendingFields?.areCategoriesEnabled).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); resolve(); }, @@ -397,7 +397,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${fakePolicy.id}`, callback: (policyCategories) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(Object.values(policyCategories ?? {}).every((category) => category.enabled === true)).toBeTruthy(); resolve(); }, @@ -410,7 +410,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.areCategoriesEnabled).toBe(true); expect(policy?.requiresCategory).toBe(true); expect(policy?.pendingFields?.areCategoriesEnabled).toBeFalsy(); @@ -819,7 +819,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${fakePolicy.id}`, callback: (policyCategories) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const category = policyCategories?.[categoryName]; expect(category?.maxAmountNoReceipt).toBe(CONST.DISABLED_MAX_EXPENSE_VALUE); @@ -840,7 +840,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${fakePolicy.id}`, callback: (policyCategories) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const category = policyCategories?.[categoryName]; expect(category?.maxAmountNoReceipt).toBe(CONST.DISABLED_MAX_EXPENSE_VALUE); @@ -892,7 +892,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${fakePolicy.id}`, callback: (policyCategories) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const category = policyCategories?.[categoryName]; expect(category?.maxAmountNoReceipt).toBe(0); @@ -913,7 +913,7 @@ describe('actions/PolicyCategory', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY_CATEGORIES}${fakePolicy.id}`, callback: (policyCategories) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const category = policyCategories?.[categoryName]; expect(category?.maxAmountNoReceipt).toBe(0); diff --git a/tests/actions/PolicyExpensifyCardTest.ts b/tests/actions/PolicyExpensifyCardTest.ts index 1e1587f60ae4..b72090d71abd 100644 --- a/tests/actions/PolicyExpensifyCardTest.ts +++ b/tests/actions/PolicyExpensifyCardTest.ts @@ -26,7 +26,7 @@ function getLoadingState() { const connection = Onyx.connect({ key: loadingStateKey, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -38,7 +38,7 @@ function getCardSettingsForFund(key: typeof unresolvedFundSettingsKey | typeof w const connection = Onyx.connect({ key, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/actions/PolicyMemberTest.ts b/tests/actions/PolicyMemberTest.ts index 85dbcb778ddc..dd682774ee6a 100644 --- a/tests/actions/PolicyMemberTest.ts +++ b/tests/actions/PolicyMemberTest.ts @@ -63,7 +63,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${fakeReport.reportID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const reportAction = reportActions?.[fakeReportAction.reportActionID]; @@ -88,7 +88,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${fakeReport.reportID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const reportAction = reportActions?.[fakeReportAction.reportActionID]; @@ -152,7 +152,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const employee = policy?.employeeList?.[fakeUser2?.login ?? '']; // Then the policy employee role of the user should be set to admin. expect(employee?.role).toBe(CONST.POLICY.ROLE.ADMIN); @@ -165,7 +165,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${adminRoom.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); // Then the user's notification preference on the admin room should be set to always. expect(report?.participants?.[fakeUser2.accountID].notificationPreference).toBe(CONST.REPORT.NOTIFICATION_PREFERENCE.ALWAYS); @@ -178,7 +178,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const employee = policy?.employeeList?.[fakeUser2?.login ?? '']; expect(employee?.pendingAction).toBeFalsy(); resolve(); @@ -193,7 +193,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); const employee = policy?.employeeList?.[fakeUser2?.login ?? '']; // Then the policy employee role of the user should be set to user. @@ -205,7 +205,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${adminRoom.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); // Then the user should be removed from the admin room participants list of the policy. expect(report?.participants?.[fakeUser2.accountID]).toBeUndefined(); @@ -286,7 +286,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.errorFields).toBeFalsy(); expect(policy?.isLoading).toBeTruthy(); expect(policy?.isChangeOwnerSuccessful).toBeFalsy(); @@ -301,7 +301,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.isLoading).toBeFalsy(); expect(policy?.isChangeOwnerSuccessful).toBeTruthy(); expect(policy?.isChangeOwnerFailed)?.toBeFalsy(); @@ -379,7 +379,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.errorFields).toBeFalsy(); expect(policy?.isLoading).toBeTruthy(); expect(policy?.isChangeOwnerSuccessful).toBeFalsy(); @@ -394,7 +394,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.isLoading).toBeFalsy(); expect(policy?.isChangeOwnerSuccessful).toBeTruthy(); expect(policy?.isChangeOwnerFailed)?.toBeFalsy(); @@ -456,7 +456,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.isLoading).toBeFalsy(); expect(policy?.isChangeOwnerSuccessful).toBeTruthy(); expect(policy?.owner).toBe(fakeEmail); @@ -513,7 +513,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.errorFields).toBeFalsy(); expect(policy?.isLoading).toBeTruthy(); expect(policy?.isChangeOwnerSuccessful).toBeFalsy(); @@ -537,7 +537,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.isLoading).toBeFalsy(); expect(policy?.isChangeOwnerSuccessful).toBeTruthy(); expect(policy?.isChangeOwnerFailed).toBeFalsy(); @@ -595,7 +595,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (policyResult) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const newEmployee = policyResult?.employeeList?.[newUserEmail]; expect(newEmployee).not.toBeUndefined(); expect(newEmployee?.email).toBe(newUserEmail); @@ -682,7 +682,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${adminRoomID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report); }, }); @@ -697,7 +697,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${adminRoomID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report); }, }); @@ -728,7 +728,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (policyResult) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const newEmployee = policyResult?.employeeList?.[newUserEmail]; expect(newEmployee?.role).toBe(CONST.POLICY.ROLE.EDITOR); resolve(); @@ -760,7 +760,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (policyResult) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const newEmployee = policyResult?.employeeList?.[newUserEmail]; expect(newEmployee?.role).toBe(CONST.POLICY.ROLE.USER); resolve(); @@ -802,7 +802,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${adminRoomID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report); }, }); @@ -851,7 +851,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${workspaceReportID}`, callback: (nvp) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(!!nvp?.private_isArchived); }, }); @@ -860,7 +860,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${expenseReportID}`, callback: (nvp) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(!!nvp?.private_isArchived); }, }); @@ -910,7 +910,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${expenseReportID}`, callback: (nvp) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(!!nvp?.private_isArchived); }, }); @@ -1034,7 +1034,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${adminRoomID}`, callback: (reportMetadata) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reportMetadata); }, }); @@ -1050,7 +1050,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_METADATA}${adminRoomID}`, callback: (reportMetadata) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reportMetadata); }, }); @@ -1126,7 +1126,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (policyResult) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(policyResult?.connections?.[CONST.POLICY.CONNECTIONS.NAME.NETSUITE]?.options?.config?.exporter); }, }); @@ -1179,7 +1179,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${workspaceReportID}`, callback: (nvp) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(!!nvp?.private_isArchived); }, }); @@ -1188,7 +1188,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${expenseReportID}`, callback: (nvp) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(!!nvp?.private_isArchived); }, }); @@ -1229,7 +1229,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (policyData) => { - Onyx.disconnect(connection); + connection.unsubscribe(); if (policyData) { resolve(policyData); } else { @@ -1281,7 +1281,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connectWithoutView({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (policyResult) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(policyResult?.employeeList); }, }); @@ -1329,7 +1329,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connectWithoutView({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (policyResult) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(policyResult?.employeeList); }, }); @@ -1534,7 +1534,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${policyID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1592,7 +1592,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${policyID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1628,7 +1628,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${policyID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1660,7 +1660,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${policyID1}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1670,7 +1670,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${policyID2}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1702,7 +1702,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${policyID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1733,7 +1733,7 @@ describe('actions/PolicyMember', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.WORKSPACE_INVITE_MEMBERS_DRAFT}${policyID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/actions/PolicyOfficeLocationTest.ts b/tests/actions/PolicyOfficeLocationTest.ts index 7282fc1a25f0..781d2d3074b7 100644 --- a/tests/actions/PolicyOfficeLocationTest.ts +++ b/tests/actions/PolicyOfficeLocationTest.ts @@ -40,7 +40,7 @@ function getPolicy(policyID: string): Promise { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(policy); }, }); diff --git a/tests/actions/PolicyProfileTest.ts b/tests/actions/PolicyProfileTest.ts index b7de75f02905..d4d35f485944 100644 --- a/tests/actions/PolicyProfileTest.ts +++ b/tests/actions/PolicyProfileTest.ts @@ -42,7 +42,7 @@ describe('actions/PolicyProfile', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.description).toBe(parsedDescription); expect(policy?.pendingFields?.description).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); @@ -57,7 +57,7 @@ describe('actions/PolicyProfile', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.pendingFields?.description).toBeFalsy(); resolve(); diff --git a/tests/actions/PolicyRulesTest.ts b/tests/actions/PolicyRulesTest.ts index ae6c472c19c8..e801d87c2d07 100644 --- a/tests/actions/PolicyRulesTest.ts +++ b/tests/actions/PolicyRulesTest.ts @@ -32,7 +32,7 @@ function getPolicy(policyID: string): Promise { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(policy); }, }); diff --git a/tests/actions/PolicyTagTest.ts b/tests/actions/PolicyTagTest.ts index c103028266c7..1252264c36dc 100644 --- a/tests/actions/PolicyTagTest.ts +++ b/tests/actions/PolicyTagTest.ts @@ -75,7 +75,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // RequiresTag is enabled and pending expect(policy?.requiresTag).toBeTruthy(); @@ -94,7 +94,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.pendingFields?.requiresTag).toBeFalsy(); resolve(); }, @@ -121,7 +121,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // RequiresTag is disabled and pending expect(policy?.requiresTag).toBeFalsy(); @@ -140,7 +140,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.pendingFields?.requiresTag).toBeFalsy(); resolve(); }, @@ -171,7 +171,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.pendingFields?.requiresTag).toBeFalsy(); expect(policy?.errors).toBeTruthy(); expect(policy?.requiresTag).toBeTruthy(); @@ -224,7 +224,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.showTagGLCodes).toBeTruthy(); expect(policy?.pendingFields?.showTagGLCodes).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); @@ -242,7 +242,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.pendingFields?.showTagGLCodes).toBeFalsy(); resolve(); }, @@ -271,7 +271,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.pendingFields?.showTagGLCodes).toBeFalsy(); expect(policy?.errorFields?.showTagGLCodes).toBeTruthy(); expect(policy?.showTagGLCodes).toBeTruthy(); diff --git a/tests/actions/PolicyTaxTest.ts b/tests/actions/PolicyTaxTest.ts index 737fe3a2be21..bf8c9f58a1e3 100644 --- a/tests/actions/PolicyTaxTest.ts +++ b/tests/actions/PolicyTaxTest.ts @@ -66,7 +66,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.taxRates?.name).toBe(customTaxName); expect(policy?.taxRates?.pendingFields?.name).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); expect(policy?.taxRates?.errorFields).toBeFalsy(); @@ -83,7 +83,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.taxRates?.pendingFields?.name).toBeFalsy(); expect(policy?.taxRates?.errorFields).toBeFalsy(); resolve(); @@ -105,7 +105,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.taxRates?.name).toBe(customTaxName); expect(policy?.taxRates?.pendingFields?.name).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); expect(policy?.taxRates?.errorFields).toBeFalsy(); @@ -125,7 +125,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.taxRates?.name).toBe(originalCustomTaxName); expect(policy?.taxRates?.pendingFields?.name).toBeFalsy(); expect(policy?.taxRates?.errorFields?.name).toBeTruthy(); @@ -150,7 +150,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.taxRates?.defaultExternalID).toBe(taxCode); expect(policy?.taxRates?.pendingFields?.defaultExternalID).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); expect(policy?.taxRates?.errorFields).toBeFalsy(); @@ -167,7 +167,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.taxRates?.pendingFields?.defaultExternalID).toBeFalsy(); expect(policy?.taxRates?.errorFields).toBeFalsy(); resolve(); @@ -189,7 +189,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.taxRates?.defaultExternalID).toBe(taxCode); expect(policy?.taxRates?.pendingFields?.defaultExternalID).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); expect(policy?.taxRates?.errorFields).toBeFalsy(); @@ -209,7 +209,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.taxRates?.defaultExternalID).toBe(originalDefaultExternalID); expect(policy?.taxRates?.pendingFields?.defaultExternalID).toBeFalsy(); expect(policy?.taxRates?.errorFields?.defaultExternalID).toBeTruthy(); @@ -233,7 +233,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.taxRates?.foreignTaxDefault).toBe(taxCode); expect(policy?.taxRates?.pendingFields?.foreignTaxDefault).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); expect(policy?.taxRates?.errorFields).toBeFalsy(); @@ -250,7 +250,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // Check if the policy pendingFields was cleared expect(policy?.taxRates?.pendingFields?.foreignTaxDefault).toBeFalsy(); expect(policy?.taxRates?.errorFields).toBeFalsy(); @@ -273,7 +273,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.taxRates?.foreignTaxDefault).toBe(taxCode); expect(policy?.taxRates?.pendingFields?.foreignTaxDefault).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); expect(policy?.taxRates?.errorFields).toBeFalsy(); @@ -294,7 +294,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); // Check if the policy pendingFields was cleared expect(policy?.taxRates?.foreignTaxDefault).toBe(originalDefaultForeignCurrencyID); expect(policy?.taxRates?.pendingFields?.foreignTaxDefault).toBeFalsy(); @@ -323,7 +323,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const createdTax = policy?.taxRates?.taxes?.[newTaxRate.code ?? '']; expect(createdTax?.code).toBe(newTaxRate.code); expect(createdTax?.name).toBe(newTaxRate.name); @@ -342,7 +342,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const createdTax = policy?.taxRates?.taxes?.[newTaxRate.code ?? '']; expect(createdTax?.errors).toBeFalsy(); expect(createdTax?.pendingFields).toBeFalsy(); @@ -369,7 +369,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const createdTax = policy?.taxRates?.taxes?.[newTaxRate.code ?? '']; expect(createdTax?.code).toBe(newTaxRate.code); expect(createdTax?.name).toBe(newTaxRate.name); @@ -391,7 +391,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const createdTax = policy?.taxRates?.taxes?.[newTaxRate.code ?? '']; expect(createdTax?.errors).toBeTruthy(); resolve(); @@ -413,7 +413,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const disabledTax = policy?.taxRates?.taxes?.[disableTaxID]; expect(disabledTax?.isDisabled).toBeTruthy(); expect(disabledTax?.pendingFields?.isDisabled).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); @@ -432,7 +432,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const disabledTax = policy?.taxRates?.taxes?.[disableTaxID]; expect(disabledTax?.errorFields?.isDisabled).toBeFalsy(); expect(disabledTax?.pendingFields?.isDisabled).toBeFalsy(); @@ -455,7 +455,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const disabledTax = policy?.taxRates?.taxes?.[disableTaxID]; expect(disabledTax?.isDisabled).toBeTruthy(); expect(disabledTax?.pendingFields?.isDisabled).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); @@ -477,7 +477,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const disabledTax = policy?.taxRates?.taxes?.[disableTaxID]; expect(disabledTax?.isDisabled).toBe(!!originalTaxes[disableTaxID].isDisabled); expect(disabledTax?.errorFields?.isDisabled).toBeTruthy(); @@ -504,7 +504,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const updatedTax = policy?.taxRates?.taxes?.[taxID]; expect(updatedTax?.name).toBe(newTaxName); expect(updatedTax?.pendingFields?.name).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); @@ -523,7 +523,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const updatedTax = policy?.taxRates?.taxes?.[taxID]; expect(updatedTax?.errorFields?.name).toBeFalsy(); expect(updatedTax?.pendingFields?.name).toBeFalsy(); @@ -548,7 +548,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const updatedTax = policy?.taxRates?.taxes?.[taxID]; expect(updatedTax?.name).toBe(newTaxName); expect(updatedTax?.pendingFields?.name).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); @@ -570,7 +570,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const updatedTax = policy?.taxRates?.taxes?.[taxID]; expect(updatedTax?.name).toBe(originalTaxRate.name); expect(updatedTax?.errorFields?.name).toBeTruthy(); @@ -597,7 +597,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const updatedTax = policy?.taxRates?.taxes?.[taxID]; expect(updatedTax?.value).toBe(stringTaxValue); expect(updatedTax?.pendingFields?.value).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); @@ -616,7 +616,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const updatedTax = policy?.taxRates?.taxes?.[taxID]; expect(updatedTax?.errorFields?.value).toBeFalsy(); expect(updatedTax?.pendingFields?.value).toBeFalsy(); @@ -642,7 +642,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const updatedTax = policy?.taxRates?.taxes?.[taxID]; expect(updatedTax?.value).toBe(stringTaxValue); expect(updatedTax?.pendingFields?.value).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); @@ -664,7 +664,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const updatedTax = policy?.taxRates?.taxes?.[taxID]; expect(updatedTax?.value).toBe(originalTaxRate.value); expect(updatedTax?.errorFields?.value).toBeTruthy(); @@ -690,7 +690,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const taxRates = policy?.taxRates; const deletedTax = taxRates?.taxes?.[taxID]; expect(taxRates?.pendingFields?.foreignTaxDefault).toBeFalsy(); @@ -710,7 +710,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const taxRates = policy?.taxRates; const deletedTax = taxRates?.taxes?.[taxID]; expect(taxRates?.pendingFields?.foreignTaxDefault).toBeFalsy(); @@ -742,7 +742,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicyWithForeignTaxDefault.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const taxRates = policy?.taxRates; const deletedTax = taxRates?.taxes?.[taxID]; expect(taxRates?.pendingFields?.foreignTaxDefault).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); @@ -762,7 +762,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicyWithForeignTaxDefault.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const taxRates = policy?.taxRates; const deletedTax = taxRates?.taxes?.[taxID]; expect(taxRates?.pendingFields?.foreignTaxDefault).toBeFalsy(); @@ -787,7 +787,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const taxRates = policy?.taxRates; const deletedTax = taxRates?.taxes?.[taxID]; expect(taxRates?.pendingFields?.foreignTaxDefault).toBeFalsy(); @@ -810,7 +810,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const taxRates = policy?.taxRates; const deletedTax = taxRates?.taxes?.[taxID]; expect(taxRates?.pendingFields?.foreignTaxDefault).toBeFalsy(); @@ -852,7 +852,7 @@ describe('actions/PolicyTax', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const taxRates = policy?.taxRates; const updatedTaxRate = taxRates?.taxes?.[newTaxCode]; diff --git a/tests/actions/PolicyTest.ts b/tests/actions/PolicyTest.ts index 6b183265aced..bce9e6162037 100644 --- a/tests/actions/PolicyTest.ts +++ b/tests/actions/PolicyTest.ts @@ -210,7 +210,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -220,7 +220,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.NVP_ACTIVE_POLICY_ID}`, callback: (id) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(id); }, }); @@ -255,7 +255,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reports); }, }); @@ -288,7 +288,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -345,7 +345,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.POLICY, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -358,7 +358,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reports); }, }); @@ -374,7 +374,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -444,7 +444,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -475,7 +475,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reports); }, }); @@ -508,7 +508,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -551,7 +551,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.POLICY, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -564,7 +564,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reports); }, }); @@ -580,7 +580,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -635,7 +635,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -708,7 +708,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -850,7 +850,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reports); }, }); @@ -904,7 +904,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -1004,7 +1004,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reports); }, }); @@ -1017,7 +1017,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT_ACTIONS, callback: (actions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(actions); }, }); @@ -1090,7 +1090,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -1158,7 +1158,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -1194,7 +1194,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -3424,7 +3424,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -3452,7 +3452,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -3479,7 +3479,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -3507,7 +3507,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -3750,7 +3750,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -3768,7 +3768,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -3868,7 +3868,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -3885,7 +3885,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -4149,7 +4149,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -4310,7 +4310,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -4452,7 +4452,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -4470,7 +4470,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -4508,7 +4508,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -4526,7 +4526,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -4561,7 +4561,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -4579,7 +4579,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -4618,7 +4618,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); @@ -4675,7 +4675,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.pendingAction).toBeUndefined(); expect(policy?.avatarURL).toBe(fakePolicy.avatarURL); resolve(); @@ -4688,7 +4688,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${fakeReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report?.stateNum).toBe(fakeReport.stateNum); expect(report?.statusNum).toBe(fakeReport.statusNum); expect(report?.policyName).toBe(fakeReport.policyName); @@ -4703,7 +4703,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${fakeReport.reportID}`, callback: (reportNameValuePairs) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(reportNameValuePairs?.private_isArchived).toBeUndefined(); resolve(); }, @@ -4715,7 +4715,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, callback: (reimbursementAccount) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(reimbursementAccount?.errors).not.toBeUndefined(); resolve(); }, @@ -4835,7 +4835,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.NVP_ACTIVE_POLICY_ID, callback: (policyID) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(policyID); }, }); @@ -4968,7 +4968,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.LAST_ACCESSED_WORKSPACE_POLICY_ID, callback: (policyID) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(policyID); }, }); @@ -5011,7 +5011,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: ONYXKEYS.LAST_ACCESSED_WORKSPACE_POLICY_ID, callback: (policyID) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(policyID); }, }); @@ -5301,7 +5301,7 @@ describe('actions/Policy', () => { key: `${ONYXKEYS.COLLECTION.POLICY_JOIN_MEMBER}${policyID}`, callback: (val) => { resolve(val); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -5339,7 +5339,7 @@ describe('actions/Policy', () => { key: `${ONYXKEYS.COLLECTION.POLICY_JOIN_MEMBER}${policyID}`, callback: (val) => { resolve(val); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -5368,7 +5368,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.maxExpenseAmountNoItemizedReceipt).toBe(expectedBackendAmount); expect(policy?.pendingFields?.maxExpenseAmountNoItemizedReceipt).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); resolve(); @@ -5384,7 +5384,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.pendingFields?.maxExpenseAmountNoItemizedReceipt).toBeFalsy(); expect(policy?.errorFields?.maxExpenseAmountNoItemizedReceipt).toBeFalsy(); resolve(); @@ -5407,7 +5407,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${fakePolicy.id}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(policy?.maxExpenseAmountNoItemizedReceipt).toBe(CONST.DISABLED_MAX_EXPENSE_VALUE); expect(policy?.pendingFields?.maxExpenseAmountNoItemizedReceipt).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE); resolve(); @@ -8657,7 +8657,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -8672,7 +8672,7 @@ describe('actions/Policy', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/actions/PolicyTravelSettingsTest.ts b/tests/actions/PolicyTravelSettingsTest.ts index f9c157f575bc..071237eedba8 100644 --- a/tests/actions/PolicyTravelSettingsTest.ts +++ b/tests/actions/PolicyTravelSettingsTest.ts @@ -17,7 +17,7 @@ function getPolicy(policyID: string): Promise { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/actions/PolicyWorkArrangementTest.ts b/tests/actions/PolicyWorkArrangementTest.ts index 9195f3f6d200..180503903ed6 100644 --- a/tests/actions/PolicyWorkArrangementTest.ts +++ b/tests/actions/PolicyWorkArrangementTest.ts @@ -18,7 +18,7 @@ function getPolicy(policyID: string): Promise { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/actions/QueuedOnyxUpdatesTest.ts b/tests/actions/QueuedOnyxUpdatesTest.ts index de9118eedd96..c46e64b09268 100644 --- a/tests/actions/QueuedOnyxUpdatesTest.ts +++ b/tests/actions/QueuedOnyxUpdatesTest.ts @@ -78,7 +78,7 @@ async function testOnyxKeyValue(key: OnyxKey): Promise { const connection = Onyx.connect({ key, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(value).toEqual(expectedValue); resolve(); @@ -119,7 +119,7 @@ describe('actions/QueuedOnyxUpdates', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}2175919089355165`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report).toBeUndefined(); resolve(); @@ -131,7 +131,7 @@ describe('actions/QueuedOnyxUpdates', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}2175919089355165`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report).toBeUndefined(); resolve(); @@ -162,7 +162,7 @@ describe('actions/QueuedOnyxUpdates', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}2175919089355165`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report).toEqual(getOnyxUpdateValue(`${ONYXKEYS.COLLECTION.REPORT}2175919089355165`)); resolve(); @@ -174,7 +174,7 @@ describe('actions/QueuedOnyxUpdates', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}2175919089355165`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(reportActions).toEqual(getOnyxUpdateValue(`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}2175919089355165`)); resolve(); diff --git a/tests/actions/ReimbursementAccountTest.ts b/tests/actions/ReimbursementAccountTest.ts index 68c3fcd0a49d..10928093696b 100644 --- a/tests/actions/ReimbursementAccountTest.ts +++ b/tests/actions/ReimbursementAccountTest.ts @@ -67,7 +67,7 @@ describe('ReimbursementAccount', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expectDisconnectedAchAccount(policy?.achAccount, TEST_EMAIL); resolve(); }, @@ -97,7 +97,7 @@ describe('ReimbursementAccount', () => { const connection = Onyx.connect({ key: ONYXKEYS.BANK_ACCOUNT_LIST, callback: (bankAccountList) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(bankAccountList?.[bankAccountID]?.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE); resolve(); }, @@ -125,7 +125,7 @@ describe('ReimbursementAccount', () => { const connection = Onyx.connect({ key: ONYXKEYS.BANK_ACCOUNT_LIST, callback: (bankAccountList) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(bankAccountList?.[bankAccountID]).toBeUndefined(); resolve(); }, @@ -159,7 +159,7 @@ describe('ReimbursementAccount', () => { const connection = Onyx.connect({ key: ONYXKEYS.BANK_ACCOUNT_LIST, callback: (bankAccountList) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(bankAccountList?.[bankAccountID]?.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.DELETE); resolve(); }, @@ -186,7 +186,7 @@ describe('ReimbursementAccount', () => { const connection = Onyx.connect({ key: ONYXKEYS.BANK_ACCOUNT_LIST, callback: (bankAccountList) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(bankAccountList?.[bankAccountID]).toBeUndefined(); resolve(); }, @@ -212,7 +212,7 @@ describe('ReimbursementAccount', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expectDisconnectedAchAccount(policy?.achAccount, TEST_EMAIL); resolve(); }, @@ -237,14 +237,14 @@ describe('ReimbursementAccount', () => { const reimbursementConnection = Onyx.connect({ key: ONYXKEYS.REIMBURSEMENT_ACCOUNT, callback: (reimbursementAccount) => { - Onyx.disconnect(reimbursementConnection); + reimbursementConnection.unsubscribe(); expect(reimbursementAccount).toEqual(CONST.REIMBURSEMENT_ACCOUNT.DEFAULT_DATA); }, }); const policyConnection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (policy) => { - Onyx.disconnect(policyConnection); + policyConnection.unsubscribe(); expectDisconnectedAchAccount(policy?.achAccount, TEST_EMAIL); resolve(); }, @@ -271,7 +271,7 @@ describe('ReimbursementAccount', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expectDisconnectedAchAccount(policy?.achAccount, designatedPayer); resolve(); }, @@ -289,7 +289,7 @@ describe('ReimbursementAccount', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expectDisconnectedAchAccount(policy?.achAccount, policyOwner); resolve(); }, diff --git a/tests/actions/ReportFieldTest.ts b/tests/actions/ReportFieldTest.ts index 1e8639df010c..64f583dcbb84 100644 --- a/tests/actions/ReportFieldTest.ts +++ b/tests/actions/ReportFieldTest.ts @@ -35,7 +35,7 @@ describe('actions/ReportField', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (workspace) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workspace); }, }); diff --git a/tests/actions/ReportTest.ts b/tests/actions/ReportTest.ts index 744b9b677c74..49ad73e5c1d0 100644 --- a/tests/actions/ReportTest.ts +++ b/tests/actions/ReportTest.ts @@ -500,7 +500,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${REPORT.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); // The report should exist but the create chat error field should be cleared. @@ -533,7 +533,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${REPORT.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); // The optimistic report should be deleted (null) since it had createChat error @@ -607,7 +607,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${REPORT.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); // The report should exist but the create chat error field should be cleared. @@ -1726,7 +1726,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: ONYXKEYS.PERSISTED_REQUESTS, callback: (persistedRequests) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(persistedRequests?.at(0)?.command).toBe(WRITE_COMMANDS.ADD_COMMENT); expect(persistedRequests?.at(1)?.command).toBeUndefined(); @@ -1741,7 +1741,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const reportAction = reportActionID ? reportActions?.[reportActionID] : null; expect(reportAction).not.toBeNull(); @@ -1772,7 +1772,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const reportAction = reportActionID ? reportActions?.[reportActionID] : undefined; expect(reportAction).toBeUndefined(); }, @@ -1893,7 +1893,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: ONYXKEYS.PERSISTED_REQUESTS, callback: (persistedRequests) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(persistedRequests?.at(0)?.command).toBe(WRITE_COMMANDS.UPDATE_COMMENT); resolve(); }, @@ -2037,7 +2037,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: ONYXKEYS.PERSISTED_REQUESTS, callback: (persistedRequests) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(persistedRequests?.at(0)?.command).toBe(WRITE_COMMANDS.ADD_ATTACHMENT); resolve(); }, @@ -2049,7 +2049,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const reportAction = reportActionID ? reportActions?.[reportActionID] : null; expect(reportAction).not.toBeNull(); expect(reportAction?.reportActionID).toBe(reportActionID); @@ -2078,7 +2078,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const reportAction = reportActionID ? reportActions?.[reportActionID] : undefined; expect(reportAction).toBeUndefined(); }, @@ -2202,7 +2202,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: ONYXKEYS.PERSISTED_REQUESTS, callback: (persistedRequests) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(persistedRequests?.at(0)?.command).toBe(WRITE_COMMANDS.ADD_TEXT_AND_ATTACHMENT); resolve(); }, @@ -2214,7 +2214,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const reportAction = reportActionID ? reportActions?.[reportActionID] : null; expect(reportAction).not.toBeNull(); expect(reportAction?.reportActionID).toBe(reportActionID); @@ -2243,7 +2243,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const reportAction = reportActionID ? reportActions?.[reportActionID] : undefined; expect(reportAction).toBeUndefined(); }, @@ -2274,7 +2274,7 @@ describe('actions/Report', () => { callback: (persisted) => { const relevant = (persisted ?? []).filter((r) => r?.command === WRITE_COMMANDS.ADD_ATTACHMENT || r?.command === WRITE_COMMANDS.ADD_TEXT_AND_ATTACHMENT); if (relevant.length >= 3) { - Onyx.disconnect(conn); + conn.unsubscribe(); resolve(relevant); } }, @@ -2367,7 +2367,7 @@ describe('actions/Report', () => { callback: (persisted) => { const relevant = (persisted ?? []).filter((r) => r?.command === WRITE_COMMANDS.ADD_ATTACHMENT || r?.command === WRITE_COMMANDS.ADD_TEXT_AND_ATTACHMENT); if (relevant.length >= 2) { - Onyx.disconnect(conn); + conn.unsubscribe(); resolve(relevant); } }, @@ -2417,7 +2417,7 @@ describe('actions/Report', () => { callback: (persisted) => { const relevant = (persisted ?? []).filter((r) => r?.command === WRITE_COMMANDS.ADD_ATTACHMENT); if (relevant.length >= 1) { - Onyx.disconnect(conn); + conn.unsubscribe(); resolve(relevant); } }, @@ -2677,7 +2677,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: ONYXKEYS.PERSISTED_REQUESTS, callback: (persistedRequests) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(persistedRequests?.at(0)?.command).toBe(WRITE_COMMANDS.ADD_COMMENT); expect(persistedRequests?.at(1)?.command).toBe(WRITE_COMMANDS.ADD_EMOJI_REACTION); expect(persistedRequests?.at(2)?.command).toBe(WRITE_COMMANDS.REMOVE_EMOJI_REACTION); @@ -2691,7 +2691,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const reportAction = reportActionID ? reportActions?.[reportActionID] : null; expect(reportAction).not.toBeNull(); expect(reportAction?.reportActionID).toBe(reportActionID); @@ -2720,7 +2720,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const reportAction = reportActionID ? reportActions?.[reportActionID] : undefined; expect(reportAction).toBeUndefined(); }, @@ -2805,7 +2805,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: ONYXKEYS.PERSISTED_REQUESTS, callback: (persistedRequests) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(persistedRequests?.at(0)?.command).toBe(WRITE_COMMANDS.ADD_EMOJI_REACTION); expect(persistedRequests?.at(1)?.command).toBe(WRITE_COMMANDS.REMOVE_EMOJI_REACTION); resolve(); @@ -3357,7 +3357,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const reportAction = reportActionID ? reportActions?.[reportActionID] : null; const message = reportAction?.message; @@ -3695,7 +3695,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReport?.reportID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const action = Object.values(reportActions ?? {}).at(0); if (!isActionOfType(action, CONST.REPORT.ACTIONS.TYPE.REPORT_PREVIEW)) { throw new Error('Expected the optimistic report preview action'); @@ -3713,7 +3713,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const createdReport = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]; const parentPolicyExpenseChat = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${parentReport?.reportID}`]; // assert correctness of crucial onyx data @@ -3737,7 +3737,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const parentPolicyExpenseChat = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${parentReport?.reportID}`]; expect(parentPolicyExpenseChat?.hasOutstandingChildRequest).toBe(parentReport?.hasOutstandingChildRequest); @@ -3786,7 +3786,7 @@ describe('actions/Report', () => { if (!loadingState?.hasOnceLoadedReportActions) { return; } - Onyx.disconnect(connection); + connection.unsubscribe(); expect(loadingState.hasOnceLoadedReportActions).toBe(true); resolve(); }, @@ -3820,7 +3820,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: ONYXKEYS.COLLECTION.REPORT, callback: (reports) => { - Onyx.disconnect(connection); + connection.unsubscribe(); const parentPolicyExpenseChat = reports?.[`${ONYXKEYS.COLLECTION.REPORT}${parentReport?.reportID}`]; expect(parentPolicyExpenseChat?.hasOutstandingChildRequest).toBe(parentReport?.hasOutstandingChildRequest); @@ -3855,7 +3855,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${optimisticReportData.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(report?.stateNum).toBe(CONST.REPORT.STATE_NUM.OPEN); expect(report?.statusNum).toBe(CONST.REPORT.STATUS_NUM.OPEN); @@ -3897,7 +3897,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${currentHash}`, callback: (snapshot) => { - Onyx.disconnect(connection); + connection.unsubscribe(); expect(snapshot?.data?.[`${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${parentReport?.reportID}`]).toBeTruthy(); expect(snapshot?.data?.[`${ONYXKEYS.COLLECTION.REPORT}${parentReport?.reportID}`]).toBeTruthy(); expect(snapshot?.data?.[`${ONYXKEYS.COLLECTION.REPORT}${reportID}`]).toBeTruthy(); @@ -3941,7 +3941,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${adminsChatReportID}`, callback: (id) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(id); }, }); @@ -4483,7 +4483,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${report.reportID}`, callback: (reportVal) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(ReportUtils.isUnread(reportVal, undefined, undefined, undefined)); }, }); @@ -4688,7 +4688,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${selfDMReportID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -4799,7 +4799,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${chatReport.reportID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -4872,7 +4872,7 @@ describe('actions/Report', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${chatReport.reportID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -4968,7 +4968,7 @@ describe('actions/Report', () => { key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${expenseReport.reportID}`, callback: (val) => { resolve(!!val?.private_isArchived); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -4979,7 +4979,7 @@ describe('actions/Report', () => { key: `${ONYXKEYS.COLLECTION.SNAPSHOT}${currentHash}`, callback: (val) => { resolve(val); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -5031,7 +5031,7 @@ describe('actions/Report', () => { const connection = Onyx.connectWithoutView({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report); }, }); @@ -5104,7 +5104,7 @@ describe('actions/Report', () => { const connection = Onyx.connectWithoutView({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report); }, }); @@ -5120,7 +5120,7 @@ describe('actions/Report', () => { const connection = Onyx.connectWithoutView({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`, callback: (txn) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(txn); }, }); @@ -5205,7 +5205,7 @@ describe('actions/Report', () => { const connection = Onyx.connectWithoutView({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report); }, }); @@ -5293,7 +5293,7 @@ describe('actions/Report', () => { const connection = Onyx.connectWithoutView({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report); }, }); @@ -5355,7 +5355,7 @@ describe('actions/Report', () => { key: `${ONYXKEYS.COLLECTION.REPORT_NAME_VALUE_PAIRS}${expenseReport.reportID}`, callback: (val) => { resolve(!!val?.private_isArchived); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -5735,7 +5735,7 @@ describe('actions/Report', () => { key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.reportID}`, callback: (val) => { resolve(val); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -6066,7 +6066,7 @@ describe('actions/Report', () => { key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${iouReport.reportID}`, callback: (val) => { resolve(val); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -6135,7 +6135,7 @@ describe('actions/Report', () => { key: `${ONYXKEYS.COLLECTION.POLICY}${policy.id}`, callback: (val) => { resolve(val); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -6191,7 +6191,7 @@ describe('actions/Report', () => { key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transactionID}`, callback: (val) => { resolve(val); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -6239,7 +6239,7 @@ describe('actions/Report', () => { key: `${ONYXKEYS.COLLECTION.REPORT}${iouReport.reportID}`, callback: (val) => { resolve(val); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); diff --git a/tests/actions/SupportTicketTest.ts b/tests/actions/SupportTicketTest.ts index 1796bdc2bc42..0015d504e31d 100644 --- a/tests/actions/SupportTicketTest.ts +++ b/tests/actions/SupportTicketTest.ts @@ -138,8 +138,8 @@ describe('actions/Report', () => { // Then the report ID is never observable without its fetch guard expect(reportStates).toEqual([true]); } finally { - Onyx.disconnect(reportConnection); - Onyx.disconnect(loadingStateConnection); + reportConnection.unsubscribe(); + loadingStateConnection.unsubscribe(); } }); diff --git a/tests/actions/TableColumnWidthsTest.ts b/tests/actions/TableColumnWidthsTest.ts index d15289c518a8..eb5f0439b37a 100644 --- a/tests/actions/TableColumnWidthsTest.ts +++ b/tests/actions/TableColumnWidthsTest.ts @@ -14,7 +14,7 @@ function getTableColumnWidths(): Promise { const connection = Onyx.connect({ key: ONYXKEYS.TABLE_COLUMN_WIDTHS, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/actions/TravelTest.ts b/tests/actions/TravelTest.ts index d1dbb7a7396c..84754e184734 100644 --- a/tests/actions/TravelTest.ts +++ b/tests/actions/TravelTest.ts @@ -75,7 +75,7 @@ describe('actions/Travel', () => { const connection = Onyx.connect({ key: ONYXKEYS.TRAVEL_PROVISIONING, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/actions/UserTest.ts b/tests/actions/UserTest.ts index 9c9437a87bcf..28eca9ca1f5a 100644 --- a/tests/actions/UserTest.ts +++ b/tests/actions/UserTest.ts @@ -139,7 +139,7 @@ describe('actions/User', () => { const connection = Onyx.connect({ key: ONYXKEYS.LOGINS, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value ?? null); }, }); @@ -171,7 +171,7 @@ describe('actions/User', () => { const connection = Onyx.connect({ key: ONYXKEYS.LOGINS, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value ?? null); }, }); @@ -215,7 +215,7 @@ describe('actions/User', () => { const connection = Onyx.connect({ key: ONYXKEYS.LOGINS, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value ?? null); }, }); @@ -254,7 +254,7 @@ describe('actions/User', () => { const connection = Onyx.connect({ key: ONYXKEYS.LOGINS, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value ?? null); }, }); @@ -417,7 +417,7 @@ describe('actions/User', () => { const connection = Onyx.connect({ key: ONYXKEYS.PENDING_CONTACT_ACTION, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value ?? null); }, }); @@ -834,7 +834,7 @@ describe('actions/User', () => { const connection = Onyx.connect({ key: ONYXKEYS.LOGINS, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value ?? null); }, }); @@ -852,7 +852,7 @@ describe('actions/User', () => { const connection = Onyx.connect({ key: ONYXKEYS.ACCOUNT, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value ?? null); }, }); @@ -865,7 +865,7 @@ describe('actions/User', () => { const connection = Onyx.connect({ key: ONYXKEYS.PENDING_CONTACT_ACTION, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value ?? null); }, }); diff --git a/tests/actions/VacationDelegateTest.ts b/tests/actions/VacationDelegateTest.ts index 58c1084c9dfd..e688d3449147 100644 --- a/tests/actions/VacationDelegateTest.ts +++ b/tests/actions/VacationDelegateTest.ts @@ -163,7 +163,7 @@ describe('actions/VacationDelegate', () => { // When a delegate is picked await setVacationDelegate({creator: 'admin@test.com', delegate: 'delegate@test.com', currentDelegate: 'old@test.com'}); await waitForBatchedUpdates(); - Onyx.disconnect(connection); + connection.unsubscribe(); // Then the policyDiff is stored, pendingDelegate points at the pick, and the saved delegate is left unchanged const vacationDelegate = await getOnyxValue(ONYXKEYS.NVP_PRIVATE_VACATION_DELEGATE); @@ -218,7 +218,7 @@ describe('actions/VacationDelegate', () => { // When a member who is missing from one of the workspaces is picked await setVacationDelegate({creator: 'admin@test.com', delegate: 'delegate@test.com', currentDelegate: 'old@test.com'}); await waitForBatchedUpdates(); - Onyx.disconnect(connection); + connection.unsubscribe(); // Then the pick never shows up as the delegate, because Profile would flash it, take it away on the 305, and show it again after the // missing workspaces step. The saved delegate stays in place the whole time. @@ -247,7 +247,7 @@ describe('actions/VacationDelegate', () => { // When a delegate is picked await setVacationDelegate({creator: 'admin@test.com', delegate: 'delegate@test.com'}); await waitForBatchedUpdates(); - Onyx.disconnect(connection); + connection.unsubscribe(); // Then the payload is never visible, because the optimistic pendingAction hides it until the action clears it, so the Profile row // never flashes a red brick road for what is really the next step of the flow diff --git a/tests/actions/WorkflowTest.ts b/tests/actions/WorkflowTest.ts index a41a81f2d683..ade14f88e13d 100644 --- a/tests/actions/WorkflowTest.ts +++ b/tests/actions/WorkflowTest.ts @@ -140,7 +140,7 @@ describe('actions/Workflow', () => { if (!workflow) { return; } - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(workflow); }, }); diff --git a/tests/ui/AddDomainPageTest.tsx b/tests/ui/AddDomainPageTest.tsx index a89c515da9e3..6442865cb84b 100644 --- a/tests/ui/AddDomainPageTest.tsx +++ b/tests/ui/AddDomainPageTest.tsx @@ -107,7 +107,7 @@ function getCreateDomainForm() { const connection = Onyx.connect({ key: ONYXKEYS.FORMS.CREATE_DOMAIN_FORM, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -119,7 +119,7 @@ function getExistingDomain() { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.DOMAIN}${EXISTING_DOMAIN_ACCOUNT_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/ui/ClearReportActionErrorsUITest.tsx b/tests/ui/ClearReportActionErrorsUITest.tsx index 0120769d359c..9a68d4209d27 100644 --- a/tests/ui/ClearReportActionErrorsUITest.tsx +++ b/tests/ui/ClearReportActionErrorsUITest.tsx @@ -52,7 +52,7 @@ function getReportActionsFromOnyx(reportID: string): Promise { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value ?? undefined); }, }); diff --git a/tests/ui/DistanceRequestStartPageTest.tsx b/tests/ui/DistanceRequestStartPageTest.tsx index a56b88d7911b..6232bdac1e3d 100644 --- a/tests/ui/DistanceRequestStartPageTest.tsx +++ b/tests/ui/DistanceRequestStartPageTest.tsx @@ -155,7 +155,7 @@ function getDraftTransaction() { key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, callback: (value) => { resolve(value); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); diff --git a/tests/ui/EnableTravelContentTest.tsx b/tests/ui/EnableTravelContentTest.tsx index ec27564ced9b..42d793f0cd3b 100644 --- a/tests/ui/EnableTravelContentTest.tsx +++ b/tests/ui/EnableTravelContentTest.tsx @@ -97,7 +97,7 @@ function getTravelProvisioning(): Promise { const connection = Onyx.connect({ key: ONYXKEYS.TRAVEL_PROVISIONING, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/ui/IOURequestRedirectToStartPageTest.tsx b/tests/ui/IOURequestRedirectToStartPageTest.tsx index 1a4d6b27c927..86c9b39ea1bf 100644 --- a/tests/ui/IOURequestRedirectToStartPageTest.tsx +++ b/tests/ui/IOURequestRedirectToStartPageTest.tsx @@ -78,7 +78,7 @@ function getOptimisticDraft() { key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, callback: (value) => { resolve(value); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); diff --git a/tests/ui/IOURequestStartPageTest.tsx b/tests/ui/IOURequestStartPageTest.tsx index 996ebf341be1..2cbdd5d7e33a 100644 --- a/tests/ui/IOURequestStartPageTest.tsx +++ b/tests/ui/IOURequestStartPageTest.tsx @@ -90,7 +90,7 @@ describe('IOURequestStartPage', () => { key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, callback: (val) => { resolve(val?.iouRequestType); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); diff --git a/tests/ui/IOURequestStepScanTest.tsx b/tests/ui/IOURequestStepScanTest.tsx index 794972495cf5..f4c6bcbb841e 100644 --- a/tests/ui/IOURequestStepScanTest.tsx +++ b/tests/ui/IOURequestStepScanTest.tsx @@ -85,7 +85,7 @@ function getTransactionsDraftOnyx(transactionID: string): Promise { resolve(val); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); diff --git a/tests/ui/MoneyRequestReportTransactionsNavigationTest.tsx b/tests/ui/MoneyRequestReportTransactionsNavigationTest.tsx index ac37d29c39a7..798ce83fdf38 100644 --- a/tests/ui/MoneyRequestReportTransactionsNavigationTest.tsx +++ b/tests/ui/MoneyRequestReportTransactionsNavigationTest.tsx @@ -376,7 +376,7 @@ async function getCarouselTransactionIDs(): Promise { const connection = Onyx.connectWithoutView({ key: ONYXKEYS.TRANSACTION_THREAD_NAVIGATION_TRANSACTION_IDS, callback: (ids) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(ids); }, }); diff --git a/tests/ui/RecentlyAddedSectionTest.tsx b/tests/ui/RecentlyAddedSectionTest.tsx index 9bad70341aef..1690b97129c3 100644 --- a/tests/ui/RecentlyAddedSectionTest.tsx +++ b/tests/ui/RecentlyAddedSectionTest.tsx @@ -506,7 +506,7 @@ describe('RecentlyAddedSection', () => { const connection = Onyx.connect({ key: ONYXKEYS.TRANSACTION_THREAD_NAVIGATION_TRANSACTION_IDS, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -515,7 +515,7 @@ describe('RecentlyAddedSection', () => { const connection = Onyx.connect({ key: ONYXKEYS.TRANSACTION_THREAD_NAVIGATION_THREAD_REPORT_IDS, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -547,7 +547,7 @@ describe('RecentlyAddedSection', () => { const connection = Onyx.connect({ key: ONYXKEYS.TRANSACTION_THREAD_NAVIGATION_TRANSACTION_IDS, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -556,7 +556,7 @@ describe('RecentlyAddedSection', () => { const connection = Onyx.connect({ key: ONYXKEYS.TRANSACTION_THREAD_NAVIGATION_THREAD_REPORT_IDS, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/ui/ScanScreenLocationTest.tsx b/tests/ui/ScanScreenLocationTest.tsx index 9a820d191ffc..df070bd6a80d 100644 --- a/tests/ui/ScanScreenLocationTest.tsx +++ b/tests/ui/ScanScreenLocationTest.tsx @@ -104,7 +104,7 @@ function getUserLocationFromOnyx(): Promise> { key: ONYXKEYS.USER_LOCATION, callback: (val) => { resolve(val); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); diff --git a/tests/ui/SessionTest.tsx b/tests/ui/SessionTest.tsx index e8fab6024baa..2edff1abdd25 100644 --- a/tests/ui/SessionTest.tsx +++ b/tests/ui/SessionTest.tsx @@ -145,7 +145,7 @@ describe('Deep linking', () => { afterEach(async () => { if (lastVisitedPathConnectionID) { - Onyx.disconnect(lastVisitedPathConnectionID); + lastVisitedPathConnectionID.unsubscribe(); lastVisitedPathConnectionID = undefined; } cleanup(); @@ -425,7 +425,7 @@ describe('signInWithShortLivedAuthToken', () => { }, }); await waitForBatchedUpdates(); - Onyx.disconnect(connectionID); + connectionID.unsubscribe(); // Guard is already set even though getDeviceInfoWithID (and thus the redeem's optimisticData) has NOT resolved. expect(isAuthenticating).toBe(true); diff --git a/tests/ui/ShareSubmitScanFieldsTest.tsx b/tests/ui/ShareSubmitScanFieldsTest.tsx index 51be16dd8653..176376a89cc0 100644 --- a/tests/ui/ShareSubmitScanFieldsTest.tsx +++ b/tests/ui/ShareSubmitScanFieldsTest.tsx @@ -49,7 +49,7 @@ function getDraft(): Promise> { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${CONST.IOU.OPTIMISTIC_TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/ui/SubmitDetailsPageTest.tsx b/tests/ui/SubmitDetailsPageTest.tsx index 75b04e2dd8ba..827434ab96b5 100644 --- a/tests/ui/SubmitDetailsPageTest.tsx +++ b/tests/ui/SubmitDetailsPageTest.tsx @@ -270,7 +270,7 @@ function getUserLocationFromOnyx(): Promise { key: ONYXKEYS.USER_LOCATION, callback: (val) => { resolve(val); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); diff --git a/tests/ui/UnreadIndicatorsTest.tsx b/tests/ui/UnreadIndicatorsTest.tsx index 3c662449d2c5..32b6b062725b 100644 --- a/tests/ui/UnreadIndicatorsTest.tsx +++ b/tests/ui/UnreadIndicatorsTest.tsx @@ -500,7 +500,7 @@ describe('Unread Indicators', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -638,7 +638,7 @@ describe('Unread Indicators', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -801,7 +801,7 @@ describe('Unread Indicators', () => { }), ); - Onyx.disconnect(connection); + connection.unsubscribe(); }); it('Do not display the new line indicator when receiving a new message from another user', async () => { @@ -941,7 +941,7 @@ describe('Unread Indicators', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); @@ -995,7 +995,7 @@ describe('Unread Indicators', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${REPORT_ID}`, callback: (val) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(val); }, }); diff --git a/tests/ui/WorkspaceMembersTest.tsx b/tests/ui/WorkspaceMembersTest.tsx index 560235769b16..b41b20e654db 100644 --- a/tests/ui/WorkspaceMembersTest.tsx +++ b/tests/ui/WorkspaceMembersTest.tsx @@ -388,7 +388,7 @@ describe('WorkspaceMembers', () => { const connection = Onyx.connect({ key: ONYXKEYS.RAM_ONLY_WORKSPACE_MEMBERS_SELECTED_FOR_ROLE_CHANGE, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/ui/WorkspaceWorkflowsApprovalsEditPageTest.tsx b/tests/ui/WorkspaceWorkflowsApprovalsEditPageTest.tsx index e8b732be0d8e..f77b9cffe08c 100644 --- a/tests/ui/WorkspaceWorkflowsApprovalsEditPageTest.tsx +++ b/tests/ui/WorkspaceWorkflowsApprovalsEditPageTest.tsx @@ -218,7 +218,7 @@ describe('WorkspaceWorkflowsApprovalsEditPage', () => { key: ONYXKEYS.APPROVAL_WORKFLOW, callback: (state) => { resolve(state?.members ?? []); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -235,7 +235,7 @@ describe('WorkspaceWorkflowsApprovalsEditPage', () => { key: ONYXKEYS.APPROVAL_WORKFLOW, callback: (state) => { resolve(state?.availableMembers ?? []); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); diff --git a/tests/ui/WorkspaceWorkflowsLockedBankAccountTest.tsx b/tests/ui/WorkspaceWorkflowsLockedBankAccountTest.tsx index 7e0cca73270b..6c6ebda27147 100644 --- a/tests/ui/WorkspaceWorkflowsLockedBankAccountTest.tsx +++ b/tests/ui/WorkspaceWorkflowsLockedBankAccountTest.tsx @@ -154,7 +154,7 @@ const getInitiatingBankAccountUnlock = () => const connection = Onyx.connect({ key: ONYXKEYS.INITIATING_BANK_ACCOUNT_UNLOCK, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/ui/WorkspaceWorkflowsSmartLimitApprovalsTest.tsx b/tests/ui/WorkspaceWorkflowsSmartLimitApprovalsTest.tsx index 3a5c4e691bc0..a5d750d8cfb2 100644 --- a/tests/ui/WorkspaceWorkflowsSmartLimitApprovalsTest.tsx +++ b/tests/ui/WorkspaceWorkflowsSmartLimitApprovalsTest.tsx @@ -89,7 +89,7 @@ const getApprovalMode = () => const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.POLICY}${POLICY_ID}`, callback: (policy) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(policy?.approvalMode); }, }); diff --git a/tests/ui/components/IOURequestStepConfirmationPageTest.tsx b/tests/ui/components/IOURequestStepConfirmationPageTest.tsx index 57498026231f..fa8e490f6f5d 100644 --- a/tests/ui/components/IOURequestStepConfirmationPageTest.tsx +++ b/tests/ui/components/IOURequestStepConfirmationPageTest.tsx @@ -626,7 +626,7 @@ describe('IOURequestStepConfirmationPageTest', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -2585,7 +2585,7 @@ describe('IOURequestStepConfirmationPageTest', () => { key: `${ONYXKEYS.COLLECTION.POLICY}${policyID}`, callback: (value) => { resolve(value); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); @@ -2605,7 +2605,7 @@ describe('IOURequestStepConfirmationPageTest', () => { key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${TRANSACTION_ID}`, callback: (value) => { resolve(value); - Onyx.disconnect(connection); + connection.unsubscribe(); }, }); }); diff --git a/tests/ui/components/ProductTrainingContextProvider.tsx b/tests/ui/components/ProductTrainingContextProvider.tsx index 88389f0a9b5d..e0de6e14640a 100644 --- a/tests/ui/components/ProductTrainingContextProvider.tsx +++ b/tests/ui/components/ProductTrainingContextProvider.tsx @@ -212,7 +212,7 @@ describe('ProductTrainingContextProvider', () => { const connection = Onyx.connect({ key: ONYXKEYS.NVP_DISMISSED_PRODUCT_TRAINING, callback: (dismissedTooltips) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(dismissedTooltips); }, }); diff --git a/tests/unit/ClearReportActionErrorsTest.ts b/tests/unit/ClearReportActionErrorsTest.ts index 81e895210001..f923a4bf0c55 100644 --- a/tests/unit/ClearReportActionErrorsTest.ts +++ b/tests/unit/ClearReportActionErrorsTest.ts @@ -23,7 +23,7 @@ function getReportActionsFromOnyx(reportID: string): Promise { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value ?? undefined); }, }); diff --git a/tests/unit/CopyPolicySettingsNavigationTest.tsx b/tests/unit/CopyPolicySettingsNavigationTest.tsx index 17b0197b9505..fe77d56c137c 100644 --- a/tests/unit/CopyPolicySettingsNavigationTest.tsx +++ b/tests/unit/CopyPolicySettingsNavigationTest.tsx @@ -110,7 +110,7 @@ async function getCopyPolicySettings(): Promise const connection = Onyx.connect({ key: ONYXKEYS.COPY_POLICY_SETTINGS, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value ?? null); }, }); diff --git a/tests/unit/DistanceRateTest.ts b/tests/unit/DistanceRateTest.ts index d3e6cce00ce3..198e88cd8caf 100644 --- a/tests/unit/DistanceRateTest.ts +++ b/tests/unit/DistanceRateTest.ts @@ -37,7 +37,7 @@ describe('DistanceRate', () => { // eslint-disable-next-line rulesdir/prefer-early-return callback: (value) => { if (value !== undefined) { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); } }, @@ -52,7 +52,7 @@ describe('DistanceRate', () => { // eslint-disable-next-line rulesdir/prefer-early-return callback: (value) => { if (value !== undefined) { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); } }, diff --git a/tests/unit/ExpenseAddedGrowlTest.tsx b/tests/unit/ExpenseAddedGrowlTest.tsx index bb4b75348c11..665668704dcd 100644 --- a/tests/unit/ExpenseAddedGrowlTest.tsx +++ b/tests/unit/ExpenseAddedGrowlTest.tsx @@ -166,7 +166,7 @@ describe('ExpenseAddedGrowl', () => { const connection = Onyx.connect({ key: ONYXKEYS.RAM_ONLY_EXPENSE_ADDED_GROWL_TRANSACTION_IDS, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/unit/MiddlewareTest.ts b/tests/unit/MiddlewareTest.ts index 772aea316f2d..68661a03e206 100644 --- a/tests/unit/MiddlewareTest.ts +++ b/tests/unit/MiddlewareTest.ts @@ -457,7 +457,7 @@ describe('Middleware', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${optimisticReportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report); }, }); @@ -468,7 +468,7 @@ describe('Middleware', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${preexistingReportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report); }, }); @@ -480,7 +480,7 @@ describe('Middleware', () => { const connection = Onyx.connect({ key: ONYXKEYS.PERSONAL_DETAILS_LIST, callback: (data) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(data); }, }); @@ -552,7 +552,7 @@ describe('Middleware', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${optimisticReportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report); }, }); @@ -564,7 +564,7 @@ describe('Middleware', () => { const connection = Onyx.connect({ key: ONYXKEYS.PERSONAL_DETAILS_LIST, callback: (data) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(data); }, }); @@ -632,7 +632,7 @@ describe('Middleware', () => { const connection = Onyx.connect({ key: ONYXKEYS.PERSONAL_DETAILS_LIST, callback: (data) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(data); }, }); @@ -701,7 +701,7 @@ describe('Middleware', () => { const connection = Onyx.connect({ key: ONYXKEYS.PERSONAL_DETAILS_LIST, callback: (data) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(data); }, }); @@ -770,7 +770,7 @@ describe('Middleware', () => { const connection = Onyx.connect({ key: ONYXKEYS.PERSONAL_DETAILS_LIST, callback: (data) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(data); }, }); @@ -826,7 +826,7 @@ describe('Middleware', () => { const connection = Onyx.connect({ key: ONYXKEYS.PERSONAL_DETAILS_LIST, callback: (data) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(data); }, }); @@ -883,7 +883,7 @@ describe('Middleware', () => { const connection = Onyx.connect({ key: ONYXKEYS.PERSONAL_DETAILS_LIST, callback: (data) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(data); }, }); diff --git a/tests/unit/Navigation/guards/MigratedUserWelcomeModalGuard.test.ts b/tests/unit/Navigation/guards/MigratedUserWelcomeModalGuard.test.ts index 24b8372eefef..0795a7545740 100644 --- a/tests/unit/Navigation/guards/MigratedUserWelcomeModalGuard.test.ts +++ b/tests/unit/Navigation/guards/MigratedUserWelcomeModalGuard.test.ts @@ -578,7 +578,7 @@ describe('MigratedUserWelcomeModalGuard', () => { await clearOnyxAndSeedFullReconnect([ONYXKEYS.IS_LOADING_APP, ONYXKEYS.NVP_TRY_NEW_DOT]); await waitForBatchedUpdates(); } finally { - Onyx.disconnect(loadingAppConnection); + loadingAppConnection.unsubscribe(); } // Then the guard must not navigate using the transient post-clear state. diff --git a/tests/unit/PaymentMethodsTest.ts b/tests/unit/PaymentMethodsTest.ts index 208271036d5d..81be1bf4981a 100644 --- a/tests/unit/PaymentMethodsTest.ts +++ b/tests/unit/PaymentMethodsTest.ts @@ -18,7 +18,7 @@ function getAddPaymentCardDraft(): Promise> { const connection = Onyx.connect({ key: ONYXKEYS.FORMS.ADD_PAYMENT_CARD_FORM_DRAFT, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/unit/ProactiveAppReviewModalManagerTest.tsx b/tests/unit/ProactiveAppReviewModalManagerTest.tsx index 884a44a1b87b..95e3f96e6f7e 100644 --- a/tests/unit/ProactiveAppReviewModalManagerTest.tsx +++ b/tests/unit/ProactiveAppReviewModalManagerTest.tsx @@ -176,7 +176,7 @@ describe('ProactiveAppReviewModalManager', () => { const connection = Onyx.connectWithoutView({ key: ONYXKEYS.APP_REVIEW_LAST_PROMPT, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/unit/ReportActionsUtilsTest.ts b/tests/unit/ReportActionsUtilsTest.ts index dea12070d11b..db5bf23ece8d 100644 --- a/tests/unit/ReportActionsUtilsTest.ts +++ b/tests/unit/ReportActionsUtilsTest.ts @@ -1378,7 +1378,7 @@ describe('ReportActionsUtils', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${report.reportID}`, callback: () => { - Onyx.disconnect(connection); + connection.unsubscribe(); const res = ReportActionsUtils.getLastVisibleAction(report.reportID); expect(res).toEqual(action2); resolve(); diff --git a/tests/unit/ReportUtilsTest.ts b/tests/unit/ReportUtilsTest.ts index fe3354fb6c20..da390dfeb760 100644 --- a/tests/unit/ReportUtilsTest.ts +++ b/tests/unit/ReportUtilsTest.ts @@ -6315,7 +6315,7 @@ describe('ReportUtils', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (report) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(report); }, }); @@ -6324,7 +6324,7 @@ describe('ReportUtils', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${expenseReport.reportID}`, callback: (reportActions) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(reportActions?.[expenseCreatedAction.reportActionID]); }, }); @@ -6333,7 +6333,7 @@ describe('ReportUtils', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${expenseTransaction.transactionID}`, callback: (transaction) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(transaction); }, }); @@ -6668,7 +6668,7 @@ describe('ReportUtils', () => { const connection = Onyx.connectWithoutView({ key: `${ONYXKEYS.SESSION}`, callback: () => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -6818,7 +6818,7 @@ describe('ReportUtils', () => { const connection = Onyx.connectWithoutView({ key: `${ONYXKEYS.SESSION}`, callback: () => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); @@ -6865,7 +6865,7 @@ describe('ReportUtils', () => { const connection = Onyx.connectWithoutView({ key: `${ONYXKEYS.SESSION}`, callback: () => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(); }, }); diff --git a/tests/unit/ReportUtilsThreadSummaryTest.ts b/tests/unit/ReportUtilsThreadSummaryTest.ts index 6b02fc91313a..0e68672463ac 100644 --- a/tests/unit/ReportUtilsThreadSummaryTest.ts +++ b/tests/unit/ReportUtilsThreadSummaryTest.ts @@ -123,7 +123,7 @@ describe('addComment thread summary attribution', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/unit/SearchActionsTest.ts b/tests/unit/SearchActionsTest.ts index 42ee1a3b4b75..768e08873811 100644 --- a/tests/unit/SearchActionsTest.ts +++ b/tests/unit/SearchActionsTest.ts @@ -856,7 +856,7 @@ describe('getPayOption', () => { }, }); await waitForBatchedUpdates(); - Onyx.disconnect(connection); + connection.unsubscribe(); expect(storedResults).toEqual(tags); }); @@ -895,7 +895,7 @@ describe('getPayOption', () => { }, }); await waitForBatchedUpdates(); - Onyx.disconnect(connection); + connection.unsubscribe(); expect(storedResults).toEqual([...existingTags, ...nextTags]); }); diff --git a/tests/unit/SequentialQueueTest.ts b/tests/unit/SequentialQueueTest.ts index 2dd57f31344f..d1d02f44f4e3 100644 --- a/tests/unit/SequentialQueueTest.ts +++ b/tests/unit/SequentialQueueTest.ts @@ -351,7 +351,7 @@ describe('SequentialQueue', () => { return; } - Onyx.disconnect(connectionId); + connectionId.unsubscribe(); expect(ongoingRequest).toEqual(persistedRequest); expect(ongoingRequest).toEqual(getOngoingRequest()); expect(getAll().length).toBe(0); @@ -598,7 +598,7 @@ describe('SequentialQueue - reconnect coverage collapse', () => { // The in-flight cycle owns the shared flag; its finallyData clears the spinner even under the drop. expect(isLoadingReportData).toBe(false); } finally { - Onyx.disconnect(connectionID); + connectionID.unsubscribe(); } }); @@ -737,7 +737,7 @@ describe('SequentialQueue - offline read reconciliation', () => { const connectionID = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${reportID}`, callback: (value) => { - Onyx.disconnect(connectionID); + connectionID.unsubscribe(); resolve(value); }, }); diff --git a/tests/unit/SplitExpenseAutoAdjustmentTest.ts b/tests/unit/SplitExpenseAutoAdjustmentTest.ts index 61b69fa85be7..c143f7004d9e 100644 --- a/tests/unit/SplitExpenseAutoAdjustmentTest.ts +++ b/tests/unit/SplitExpenseAutoAdjustmentTest.ts @@ -81,7 +81,7 @@ describe('Split Expense Auto-Adjustment', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${ORIGINAL_TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -121,7 +121,7 @@ describe('Split Expense Auto-Adjustment', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${ORIGINAL_TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -157,7 +157,7 @@ describe('Split Expense Auto-Adjustment', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${ORIGINAL_TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -221,7 +221,7 @@ describe('Split Expense Auto-Adjustment', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${originalTransactionID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -254,7 +254,7 @@ describe('Split Expense Auto-Adjustment', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${ORIGINAL_TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -298,7 +298,7 @@ describe('Split Expense Auto-Adjustment', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${ORIGINAL_TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -336,7 +336,7 @@ describe('Split Expense Auto-Adjustment', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${ORIGINAL_TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -378,7 +378,7 @@ describe('Split Expense Auto-Adjustment', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${ORIGINAL_TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -422,7 +422,7 @@ describe('Split Expense Auto-Adjustment', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${ORIGINAL_TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -458,7 +458,7 @@ describe('Split Expense Auto-Adjustment', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${ORIGINAL_TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -500,7 +500,7 @@ describe('Split Expense Auto-Adjustment', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${ORIGINAL_TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -536,7 +536,7 @@ describe('Split Expense Auto-Adjustment', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${ORIGINAL_TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -568,7 +568,7 @@ describe('Split Expense Auto-Adjustment', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${ORIGINAL_TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -603,7 +603,7 @@ describe('Split Expense Auto-Adjustment', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${ORIGINAL_TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -643,7 +643,7 @@ describe('Split Expense Auto-Adjustment', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.SPLIT_TRANSACTION_DRAFT}${ORIGINAL_TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/unit/TransactionTest.ts b/tests/unit/TransactionTest.ts index 1b3fab773dd6..bf9e07a2bc4a 100644 --- a/tests/unit/TransactionTest.ts +++ b/tests/unit/TransactionTest.ts @@ -250,7 +250,7 @@ describe('Transaction', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${FAKE_NEW_REPORT_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -292,7 +292,7 @@ describe('Transaction', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT_ACTIONS}${FAKE_NEW_REPORT_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -845,7 +845,7 @@ describe('Transaction', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -898,7 +898,7 @@ describe('Transaction', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -958,7 +958,7 @@ describe('Transaction', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${newExpenseReport.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1018,7 +1018,7 @@ describe('Transaction', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${newExpenseReport.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1074,7 +1074,7 @@ describe('Transaction', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${oldExpenseReport.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1131,7 +1131,7 @@ describe('Transaction', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${oldExpenseReport.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1201,7 +1201,7 @@ describe('Transaction', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${oldExpenseReport.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1485,7 +1485,7 @@ describe('Transaction', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.REPORT}${expenseReport.reportID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); @@ -1706,7 +1706,7 @@ describe('Transaction', () => { const connection = Onyx.connect({ key: `${ONYXKEYS.COLLECTION.TRANSACTION}${transaction.transactionID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/unit/TryNewDotUtilsTest.ts b/tests/unit/TryNewDotUtilsTest.ts index 28a16406c7bf..8fc299fbefd1 100644 --- a/tests/unit/TryNewDotUtilsTest.ts +++ b/tests/unit/TryNewDotUtilsTest.ts @@ -15,7 +15,7 @@ function getTryNewDot(): Promise { const connectionID = Onyx.connect({ key: ONYXKEYS.NVP_TRY_NEW_DOT, callback: (value) => { - Onyx.disconnect(connectionID); + connectionID.unsubscribe(); resolve(value ?? null); }, }); diff --git a/tests/unit/hooks/useInsightsFilters.test.ts b/tests/unit/hooks/useInsightsFilters.test.ts index e8b78f2604e5..655d1cead755 100644 --- a/tests/unit/hooks/useInsightsFilters.test.ts +++ b/tests/unit/hooks/useInsightsFilters.test.ts @@ -34,7 +34,7 @@ async function getStoredQuery(): Promise { const connection = Onyx.connectWithoutView({ key: ONYXKEYS.SEARCH_FILTERS, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value as Record | undefined); }, }); diff --git a/tests/unit/libs/actions/TransactionThreadNavigationTest.ts b/tests/unit/libs/actions/TransactionThreadNavigationTest.ts index e8dfd0e9506e..0cc611751d08 100644 --- a/tests/unit/libs/actions/TransactionThreadNavigationTest.ts +++ b/tests/unit/libs/actions/TransactionThreadNavigationTest.ts @@ -48,7 +48,7 @@ describe('TransactionThreadNavigation carousel ownership', () => { const connection = Onyx.connect({ key, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value); }, }); diff --git a/tests/unit/setCustomUnitRateIDMapRouteTest.ts b/tests/unit/setCustomUnitRateIDMapRouteTest.ts index 1fd22b1801e1..d3bd42b7e252 100644 --- a/tests/unit/setCustomUnitRateIDMapRouteTest.ts +++ b/tests/unit/setCustomUnitRateIDMapRouteTest.ts @@ -48,7 +48,7 @@ async function switchToKilometerRate(transaction: Transaction) { const connection = Onyx.connectWithoutView({ key: `${ONYXKEYS.COLLECTION.TRANSACTION_DRAFT}${TRANSACTION_ID}`, callback: (value) => { - Onyx.disconnect(connection); + connection.unsubscribe(); resolve(value ?? undefined); }, }); diff --git a/tests/utils/TestHelper.ts b/tests/utils/TestHelper.ts index b89d578a0512..0729eb6624a6 100644 --- a/tests/utils/TestHelper.ts +++ b/tests/utils/TestHelper.ts @@ -124,7 +124,7 @@ function getOnyxData(options: ConnectOptions) { const connectionID = Onyx.connect({ ...options, callback: (...params: ConnectionCallbackParams) => { - Onyx.disconnect(connectionID); + connectionID.unsubscribe(); options.callback?.(...params); resolve(); },