diff --git a/package-lock.json b/package-lock.json index c5f786342a27..f481c16af01c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -222,7 +222,7 @@ "react-native-performance-flipper-reporter": "^2.0.0", "react-native-svg-transformer": "^1.0.0", "react-test-renderer": "18.2.0", - "reassure": "^0.9.0", + "reassure": "^0.10.1", "setimmediate": "^1.0.5", "shellcheck": "^1.1.0", "style-loader": "^2.0.0", @@ -2539,16 +2539,21 @@ "integrity": "sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==" }, "node_modules/@babel/runtime": { - "version": "7.22.3", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.3.tgz", - "integrity": "sha512-XsDuspWKLUsxwCp6r7EhsExHtYfbe5oAGQ19kqngTdCPUoPQzOPdUbD/pB9PJiwb2ptYKQDjSJT3R6dC+EPqfQ==", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.2.tgz", + "integrity": "sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==", "dependencies": { - "regenerator-runtime": "^0.13.11" + "regenerator-runtime": "^0.14.0" }, "engines": { "node": ">=6.9.0" } }, + "node_modules/@babel/runtime/node_modules/regenerator-runtime": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", + "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==" + }, "node_modules/@babel/template": { "version": "7.22.5", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.22.5.tgz", @@ -2623,13 +2628,13 @@ "license": "Apache-2.0" }, "node_modules/@callstack/reassure-cli": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@callstack/reassure-cli/-/reassure-cli-0.9.0.tgz", - "integrity": "sha512-auoxqyilxkT5mDdEPJqRRY+ZGlrihJjFQpopcFd/15ng76OPVka3L48RMEY2wXkFXLaOOs6enNGb596jYPuEtQ==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@callstack/reassure-cli/-/reassure-cli-0.10.0.tgz", + "integrity": "sha512-CYgOGOAWcFgA2GrJw6RJAvImCpHCpPbtPoYMDol7esjlRCX2QwIKG7/9byq47hML57w94fhFAa76KD84YlgMBg==", "dev": true, "dependencies": { - "@callstack/reassure-compare": "0.5.0", - "@callstack/reassure-logger": "0.3.0", + "@callstack/reassure-compare": "0.6.0", + "@callstack/reassure-logger": "0.3.1", "chalk": "4.1.2", "simple-git": "^3.16.0", "yargs": "^17.6.2" @@ -2759,12 +2764,12 @@ } }, "node_modules/@callstack/reassure-compare": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@callstack/reassure-compare/-/reassure-compare-0.5.0.tgz", - "integrity": "sha512-3sBeJ/+Hxjdb01KVb8LszO1kcJ8TXcrVnerUj+LYn2dkBOohAMqGYaOvCeoWsVEHJ+MIOzmvAGBJQRu69RoJdQ==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@callstack/reassure-compare/-/reassure-compare-0.6.0.tgz", + "integrity": "sha512-P3nmv36CJrQSXg0+z6EuEV/0xAbvxWbAZ7diQHnkbvqk2z8PKRXpkcthrRUpe02wLewa0MLxBUJwLenFnhxIRg==", "dev": true, "dependencies": { - "@callstack/reassure-logger": "0.3.0", + "@callstack/reassure-logger": "0.3.1", "markdown-builder": "^0.9.0", "markdown-table": "^2.0.0", "zod": "^3.20.2" @@ -2777,9 +2782,9 @@ "dev": true }, "node_modules/@callstack/reassure-logger": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@callstack/reassure-logger/-/reassure-logger-0.3.0.tgz", - "integrity": "sha512-JX5o+8qkIbIRL+cQn9XlQYdv9p/3L6J70zZX6NYi9j0VrSS9PZIRfo8ujMdLSqUNV6HZN1ay59RzuncLjVu0aQ==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@callstack/reassure-logger/-/reassure-logger-0.3.1.tgz", + "integrity": "sha512-IUsNrxVMdt0zgD2IN2snGVGUG8Yc6F3SWaPF8RXUn8qi7XZuYC6WevEL+mIKmlbTTa7qlX9brkn0pJoXAjfcPQ==", "dev": true, "dependencies": { "chalk": "4.1.2" @@ -2856,12 +2861,12 @@ } }, "node_modules/@callstack/reassure-measure": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@callstack/reassure-measure/-/reassure-measure-0.5.0.tgz", - "integrity": "sha512-KwlmNYcspBOp7FIw6XOz5O9mnKB4cWCCyM6vG4nFUPHSWQ6yVdRkawVvoPIV5qJ2hw7zCzdtqRrLWQSTF4eKlg==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@callstack/reassure-measure/-/reassure-measure-0.6.0.tgz", + "integrity": "sha512-phXY5DAtKhnu8dA2pmnl+pqFOfrVEFFDJOi4AnObwIcpDSn3IUXgNSe7rSi+JP/mXNWMLoUS8rnH4iIFDyf7qQ==", "dev": true, "dependencies": { - "@callstack/reassure-logger": "0.3.0", + "@callstack/reassure-logger": "0.3.1", "mathjs": "^11.5.0" }, "peerDependencies": { @@ -31380,16 +31385,16 @@ } }, "node_modules/fraction.js": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz", - "integrity": "sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.4.tgz", + "integrity": "sha512-pwiTgt0Q7t+GHZA4yaLjObx4vXmmdcS0iSJ19o8d/goUGgItX9UZWKWNnLHehxviD8wU2IWRsnR8cD5+yOJP2Q==", "dev": true, "engines": { "node": "*" }, "funding": { "type": "patreon", - "url": "https://www.patreon.com/infusion" + "url": "https://github.com/sponsors/rawify" } }, "node_modules/fragment-cache": { @@ -38283,20 +38288,20 @@ } }, "node_modules/mathjs": { - "version": "11.8.0", - "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-11.8.0.tgz", - "integrity": "sha512-I7r8HCoqUGyEiHQdeOCF2m2k9N+tcOHO3cZQ3tyJkMMBQMFqMR7dMQEboBMJAiFW2Um3PEItGPwcOc4P6KRqwg==", + "version": "11.11.2", + "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-11.11.2.tgz", + "integrity": "sha512-SL4/0Fxm9X4sgovUpJTeyVeZ2Ifnk4tzLPTYWDyR3AIx9SabnXYqtCkyJtmoF3vZrDPKGkLvrhbIL4YN2YbXLQ==", "dev": true, "dependencies": { - "@babel/runtime": "^7.21.0", + "@babel/runtime": "^7.23.1", "complex.js": "^2.1.1", "decimal.js": "^10.4.3", "escape-latex": "^1.2.0", - "fraction.js": "^4.2.0", + "fraction.js": "4.3.4", "javascript-natural-sort": "^0.7.1", "seedrandom": "^3.0.5", "tiny-emitter": "^2.1.0", - "typed-function": "^4.1.0" + "typed-function": "^4.1.1" }, "bin": { "mathjs": "bin/cli.js" @@ -46189,14 +46194,14 @@ "integrity": "sha512-k2d6ACCkiNYz222Fs/iNze30rRJ1iIicW7JuX/7/cozvih6YCkFZH+J6mAFDVgv0dRBaAyr4jDqC95R2y4IADg==" }, "node_modules/reassure": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/reassure/-/reassure-0.9.0.tgz", - "integrity": "sha512-FIf0GPchyPGItsrW5Wwff/NWVrfOcCUuJJSs4Nur6iRdQt8yvmCpcba4UyemdZ1KaFTIW1gKbAV3u2tuA7zmtQ==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/reassure/-/reassure-0.10.1.tgz", + "integrity": "sha512-+GANr5ojh32NZu1YGfa6W8vIJm3iOIZJUvXT5Gc9fQyre7okYsCzyBq9WsHbnAQDjNq1g9SsM/4bwcVET9OIqA==", "dev": true, "dependencies": { - "@callstack/reassure-cli": "0.9.0", + "@callstack/reassure-cli": "0.10.0", "@callstack/reassure-danger": "0.1.1", - "@callstack/reassure-measure": "0.5.0" + "@callstack/reassure-measure": "0.6.0" } }, "node_modules/recast": { @@ -49131,7 +49136,6 @@ "resolved": "https://registry.npmjs.org/strip-eof/-/strip-eof-1.0.0.tgz", "integrity": "sha512-7FCwGGmx8mD5xQd3RPUvnSpUXHM3BWuzjtpD4TXsfcZ9EL4azvVVUscFYwD9nx8Kh+uCBC00XBtAykoMHwTh8Q==", "dev": true, - "license": "MIT", "engines": { "node": ">=0.10.0" } @@ -50391,9 +50395,9 @@ } }, "node_modules/typed-function": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-4.1.0.tgz", - "integrity": "sha512-DGwUl6cioBW5gw2L+6SMupGwH/kZOqivy17E4nsh1JI9fKF87orMmlQx3KISQPmg3sfnOUGlwVkroosvgddrlg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-4.1.1.tgz", + "integrity": "sha512-Pq1DVubcvibmm8bYcMowjVnnMwPVMeh0DIdA8ad8NZY2sJgapANJmiigSUwlt+EgXxpfIv8MWrQXTIzkfYZLYQ==", "dev": true, "engines": { "node": ">= 14" @@ -53266,9 +53270,9 @@ } }, "node_modules/zod": { - "version": "3.21.4", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz", - "integrity": "sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==", + "version": "3.22.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz", + "integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==", "dev": true, "funding": { "url": "https://github.com/sponsors/colinhacks" @@ -54803,11 +54807,18 @@ "integrity": "sha512-x/rqGMdzj+fWZvCOYForTghzbtqPDZ5gPwaoNGHdgDfF2QA/XZbCBp4Moo5scrkAMPhB7z26XM/AaHuIJdgauA==" }, "@babel/runtime": { - "version": "7.22.3", - "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.22.3.tgz", - "integrity": "sha512-XsDuspWKLUsxwCp6r7EhsExHtYfbe5oAGQ19kqngTdCPUoPQzOPdUbD/pB9PJiwb2ptYKQDjSJT3R6dC+EPqfQ==", + "version": "7.23.2", + "resolved": "https://registry.npmjs.org/@babel/runtime/-/runtime-7.23.2.tgz", + "integrity": "sha512-mM8eg4yl5D6i3lu2QKPuPH4FArvJ8KhTofbE7jwMUv9KX5mBvwPAqnV3MlyBNqdp9RyRKP6Yck8TrfYrPvX3bg==", "requires": { - "regenerator-runtime": "^0.13.11" + "regenerator-runtime": "^0.14.0" + }, + "dependencies": { + "regenerator-runtime": { + "version": "0.14.0", + "resolved": "https://registry.npmjs.org/regenerator-runtime/-/regenerator-runtime-0.14.0.tgz", + "integrity": "sha512-srw17NI0TUWHuGa5CFGGmhfNIeja30WMBfbslPNhf6JrqQlLN5gcrvig1oqPxiVaXb0oW0XRKtH6Nngs5lKCIA==" + } } }, "@babel/template": { @@ -54871,13 +54882,13 @@ "dev": true }, "@callstack/reassure-cli": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/@callstack/reassure-cli/-/reassure-cli-0.9.0.tgz", - "integrity": "sha512-auoxqyilxkT5mDdEPJqRRY+ZGlrihJjFQpopcFd/15ng76OPVka3L48RMEY2wXkFXLaOOs6enNGb596jYPuEtQ==", + "version": "0.10.0", + "resolved": "https://registry.npmjs.org/@callstack/reassure-cli/-/reassure-cli-0.10.0.tgz", + "integrity": "sha512-CYgOGOAWcFgA2GrJw6RJAvImCpHCpPbtPoYMDol7esjlRCX2QwIKG7/9byq47hML57w94fhFAa76KD84YlgMBg==", "dev": true, "requires": { - "@callstack/reassure-compare": "0.5.0", - "@callstack/reassure-logger": "0.3.0", + "@callstack/reassure-compare": "0.6.0", + "@callstack/reassure-logger": "0.3.1", "chalk": "4.1.2", "simple-git": "^3.16.0", "yargs": "^17.6.2" @@ -54973,12 +54984,12 @@ } }, "@callstack/reassure-compare": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@callstack/reassure-compare/-/reassure-compare-0.5.0.tgz", - "integrity": "sha512-3sBeJ/+Hxjdb01KVb8LszO1kcJ8TXcrVnerUj+LYn2dkBOohAMqGYaOvCeoWsVEHJ+MIOzmvAGBJQRu69RoJdQ==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@callstack/reassure-compare/-/reassure-compare-0.6.0.tgz", + "integrity": "sha512-P3nmv36CJrQSXg0+z6EuEV/0xAbvxWbAZ7diQHnkbvqk2z8PKRXpkcthrRUpe02wLewa0MLxBUJwLenFnhxIRg==", "dev": true, "requires": { - "@callstack/reassure-logger": "0.3.0", + "@callstack/reassure-logger": "0.3.1", "markdown-builder": "^0.9.0", "markdown-table": "^2.0.0", "zod": "^3.20.2" @@ -54991,9 +55002,9 @@ "dev": true }, "@callstack/reassure-logger": { - "version": "0.3.0", - "resolved": "https://registry.npmjs.org/@callstack/reassure-logger/-/reassure-logger-0.3.0.tgz", - "integrity": "sha512-JX5o+8qkIbIRL+cQn9XlQYdv9p/3L6J70zZX6NYi9j0VrSS9PZIRfo8ujMdLSqUNV6HZN1ay59RzuncLjVu0aQ==", + "version": "0.3.1", + "resolved": "https://registry.npmjs.org/@callstack/reassure-logger/-/reassure-logger-0.3.1.tgz", + "integrity": "sha512-IUsNrxVMdt0zgD2IN2snGVGUG8Yc6F3SWaPF8RXUn8qi7XZuYC6WevEL+mIKmlbTTa7qlX9brkn0pJoXAjfcPQ==", "dev": true, "requires": { "chalk": "4.1.2" @@ -55051,12 +55062,12 @@ } }, "@callstack/reassure-measure": { - "version": "0.5.0", - "resolved": "https://registry.npmjs.org/@callstack/reassure-measure/-/reassure-measure-0.5.0.tgz", - "integrity": "sha512-KwlmNYcspBOp7FIw6XOz5O9mnKB4cWCCyM6vG4nFUPHSWQ6yVdRkawVvoPIV5qJ2hw7zCzdtqRrLWQSTF4eKlg==", + "version": "0.6.0", + "resolved": "https://registry.npmjs.org/@callstack/reassure-measure/-/reassure-measure-0.6.0.tgz", + "integrity": "sha512-phXY5DAtKhnu8dA2pmnl+pqFOfrVEFFDJOi4AnObwIcpDSn3IUXgNSe7rSi+JP/mXNWMLoUS8rnH4iIFDyf7qQ==", "dev": true, "requires": { - "@callstack/reassure-logger": "0.3.0", + "@callstack/reassure-logger": "0.3.1", "mathjs": "^11.5.0" } }, @@ -75708,9 +75719,9 @@ "dev": true }, "fraction.js": { - "version": "4.2.0", - "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.2.0.tgz", - "integrity": "sha512-MhLuK+2gUcnZe8ZHlaaINnQLl0xRIGRfcGk2yl8xoQAfHrSsL3rYu6FCmBdkdbhc9EPlwyGHewaRsvwRMJtAlA==", + "version": "4.3.4", + "resolved": "https://registry.npmjs.org/fraction.js/-/fraction.js-4.3.4.tgz", + "integrity": "sha512-pwiTgt0Q7t+GHZA4yaLjObx4vXmmdcS0iSJ19o8d/goUGgItX9UZWKWNnLHehxviD8wU2IWRsnR8cD5+yOJP2Q==", "dev": true }, "fragment-cache": { @@ -80554,20 +80565,20 @@ } }, "mathjs": { - "version": "11.8.0", - "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-11.8.0.tgz", - "integrity": "sha512-I7r8HCoqUGyEiHQdeOCF2m2k9N+tcOHO3cZQ3tyJkMMBQMFqMR7dMQEboBMJAiFW2Um3PEItGPwcOc4P6KRqwg==", + "version": "11.11.2", + "resolved": "https://registry.npmjs.org/mathjs/-/mathjs-11.11.2.tgz", + "integrity": "sha512-SL4/0Fxm9X4sgovUpJTeyVeZ2Ifnk4tzLPTYWDyR3AIx9SabnXYqtCkyJtmoF3vZrDPKGkLvrhbIL4YN2YbXLQ==", "dev": true, "requires": { - "@babel/runtime": "^7.21.0", + "@babel/runtime": "^7.23.1", "complex.js": "^2.1.1", "decimal.js": "^10.4.3", "escape-latex": "^1.2.0", - "fraction.js": "^4.2.0", + "fraction.js": "4.3.4", "javascript-natural-sort": "^0.7.1", "seedrandom": "^3.0.5", "tiny-emitter": "^2.1.0", - "typed-function": "^4.1.0" + "typed-function": "^4.1.1" } }, "md5.js": { @@ -86180,14 +86191,14 @@ "integrity": "sha512-k2d6ACCkiNYz222Fs/iNze30rRJ1iIicW7JuX/7/cozvih6YCkFZH+J6mAFDVgv0dRBaAyr4jDqC95R2y4IADg==" }, "reassure": { - "version": "0.9.0", - "resolved": "https://registry.npmjs.org/reassure/-/reassure-0.9.0.tgz", - "integrity": "sha512-FIf0GPchyPGItsrW5Wwff/NWVrfOcCUuJJSs4Nur6iRdQt8yvmCpcba4UyemdZ1KaFTIW1gKbAV3u2tuA7zmtQ==", + "version": "0.10.1", + "resolved": "https://registry.npmjs.org/reassure/-/reassure-0.10.1.tgz", + "integrity": "sha512-+GANr5ojh32NZu1YGfa6W8vIJm3iOIZJUvXT5Gc9fQyre7okYsCzyBq9WsHbnAQDjNq1g9SsM/4bwcVET9OIqA==", "dev": true, "requires": { - "@callstack/reassure-cli": "0.9.0", + "@callstack/reassure-cli": "0.10.0", "@callstack/reassure-danger": "0.1.1", - "@callstack/reassure-measure": "0.5.0" + "@callstack/reassure-measure": "0.6.0" } }, "recast": { @@ -89273,9 +89284,9 @@ } }, "typed-function": { - "version": "4.1.0", - "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-4.1.0.tgz", - "integrity": "sha512-DGwUl6cioBW5gw2L+6SMupGwH/kZOqivy17E4nsh1JI9fKF87orMmlQx3KISQPmg3sfnOUGlwVkroosvgddrlg==", + "version": "4.1.1", + "resolved": "https://registry.npmjs.org/typed-function/-/typed-function-4.1.1.tgz", + "integrity": "sha512-Pq1DVubcvibmm8bYcMowjVnnMwPVMeh0DIdA8ad8NZY2sJgapANJmiigSUwlt+EgXxpfIv8MWrQXTIzkfYZLYQ==", "dev": true }, "typedarray": { @@ -91301,9 +91312,9 @@ "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==" }, "zod": { - "version": "3.21.4", - "resolved": "https://registry.npmjs.org/zod/-/zod-3.21.4.tgz", - "integrity": "sha512-m46AKbrzKVzOzs/DZgVnG5H55N1sv1M8qZU3A8RIKbs3mrACDNeIOeilDymVb2HdmP8uwshOCF4uJ8uM9rCqJw==", + "version": "3.22.4", + "resolved": "https://registry.npmjs.org/zod/-/zod-3.22.4.tgz", + "integrity": "sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==", "dev": true }, "zwitch": { diff --git a/package.json b/package.json index 193b6d2475dd..8ee80d63d259 100644 --- a/package.json +++ b/package.json @@ -267,7 +267,7 @@ "react-native-performance-flipper-reporter": "^2.0.0", "react-native-svg-transformer": "^1.0.0", "react-test-renderer": "18.2.0", - "reassure": "^0.9.0", + "reassure": "^0.10.1", "setimmediate": "^1.0.5", "shellcheck": "^1.1.0", "style-loader": "^2.0.0", diff --git a/tests/perf-test/GooglePlacesUtils.perf-test.js b/tests/perf-test/GooglePlacesUtils.perf-test.js new file mode 100644 index 000000000000..92c3e0eb87b7 --- /dev/null +++ b/tests/perf-test/GooglePlacesUtils.perf-test.js @@ -0,0 +1,163 @@ +import {measureFunction} from 'reassure'; +import * as GooglePlacesUtils from '../../src/libs/GooglePlacesUtils'; + +jest.setTimeout(60000); + +const addressComponents = [ + { + long_name: 'Bushwick', + short_name: 'Bushwick', + types: ['neighborhood', 'political'], + }, + { + long_name: 'Brooklyn', + short_name: 'Brooklyn', + types: ['sublocality_level_1', 'sublocality', 'political'], + }, + { + long_name: 'New York', + short_name: 'NY', + types: ['administrative_area_level_1', 'political'], + }, + { + long_name: 'United States', + short_name: 'US', + types: ['country', 'political'], + }, + { + long_name: '11206', + short_name: '11206', + types: ['postal_code'], + }, + { + long_name: 'United Kingdom', + short_name: 'UK', + types: ['country', 'political'], + }, +]; + +const bigObjectToFind = { + sublocality: 'long_name', + administrative_area_level_1: 'short_name', + postal_code: 'long_name', + 'doesnt-exist': 'long_name', + s1ublocality: 'long_name', + a1dministrative_area_level_1: 'short_name', + p1ostal_code: 'long_name', + '1doesnt-exist': 'long_name', + s2ublocality: 'long_name', + a2dministrative_area_level_1: 'short_name', + p2ostal_code: 'long_name', + '2doesnt-exist': 'long_name', + s3ublocality: 'long_name', + a3dministrative_area_level_1: 'short_name', + p3ostal_code: 'long_name', + '3doesnt-exist': 'long_name', + s4ublocality: 'long_name', + a4dministrative_area_level_1: 'short_name', + p4ostal_code: 'long_name', + '4doesnt-exist': 'long_name', + s5ublocality: 'long_name', + a5dministrative_area_level_1: 'short_name', + p5ostal_code: 'long_name', + '5doesnt-exist': 'long_name', + s6ublocality: 'long_name', + a6dministrative_area_level_1: 'short_name', + p6ostal_code: 'long_name', + '6doesnt-exist': 'long_name', + s7ublocality: 'long_name', + a7dministrative_area_level_1: 'short_name', + p7ostal_code: 'long_name', + '7doesnt-exist': 'long_name', + s8ublocality: 'long_name', + a8dministrative_area_level_1: 'short_name', + p8ostal_code: 'long_name', + '8doesnt-exist': 'long_name', + s9ublocality: 'long_name', + a9dministrative_area_level_1: 'short_name', + p9ostal_code: 'long_name', + '9doesnt-exist': 'long_name', + s10ublocality: 'long_name', + a10dministrative_area_level_1: 'short_name', + p10ostal_code: 'long_name', + '10doesnt-exist': 'long_name', + s11ublocality: 'long_name', + a11dministrative_area_level_1: 'short_name', + p11ostal_code: 'long_name', + '11doesnt-exist': 'long_name', + s12ublocality: 'long_name', + a12dministrative_area_level_1: 'short_name', + p12ostal_code: 'long_name', + '12doesnt-exist': 'long_name', + s13ublocality: 'long_name', + a13dministrative_area_level_1: 'short_name', + p13ostal_code: 'long_name', + '13doesnt-exist': 'long_name', + s14ublocality: 'long_name', + a14dministrative_area_level_1: 'short_name', + p14ostal_code: 'long_name', + '14doesnt-exist': 'long_name', + s15ublocality: 'long_name', + a15dministrative_area_level_1: 'short_name', + p15ostal_code: 'long_name', + '15doesnt-exist': 'long_name', + s16ublocality: 'long_name', + a16dministrative_area_level_1: 'short_name', + p16ostal_code: 'long_name', + '16doesnt-exist': 'long_name', + s17ublocality: 'long_name', + a17dministrative_area_level_1: 'short_name', + p17ostal_code: 'long_name', + '17doesnt-exist': 'long_name', + s18ublocality: 'long_name', + a18dministrative_area_level_1: 'short_name', + p18ostal_code: 'long_name', + '18doesnt-exist': 'long_name', + s19ublocality: 'long_name', + a19dministrative_area_level_1: 'short_name', + p19ostal_code: 'long_name', + '19doesnt-exist': 'long_name', + s20ublocality: 'long_name', + a20dministrative_area_level_1: 'short_name', + p20ostal_code: 'long_name', + '20doesnt-exist': 'long_name', + s21ublocality: 'long_name', + a21dministrative_area_level_1: 'short_name', + p21ostal_code: 'long_name', + '21doesnt-exist': 'long_name', + s22ublocality: 'long_name', + a22dministrative_area_level_1: 'short_name', + p22ostal_code: 'long_name', + '22doesnt-exist': 'long_name', + s23ublocality: 'long_name', + a23dministrative_area_level_1: 'short_name', + p23ostal_code: 'long_name', + '23doesnt-exist': 'long_name', + s24ublocality: 'long_name', + a24dministrative_area_level_1: 'short_name', + p24ostal_code: 'long_name', + '24doesnt-exist': 'long_name', + s25ublocality: 'long_name', + a25dministrative_area_level_1: 'short_name', + p25ostal_code: 'long_name', + '25doesnt-exist': 'long_name', +}; + +/** + * This function will be executed 20 times and the average time will be used on the comparison. + * It will fail based on the CI configuration around Reassure: + * @see /.github/workflows/reassurePerformanceTests.yml + * + * Max deviation on the duration is set to 20% at the time of writing. + * + * More on the measureFunction API: + * @see https://callstack.github.io/reassure/docs/api#measurefunction-function + */ +test('getAddressComponents on a big dataset', async () => { + await measureFunction( + () => { + GooglePlacesUtils.getAddressComponents(addressComponents, bigObjectToFind); + }, + {runs: 20}, + ); +}); diff --git a/tests/unit/GooglePlacesUtilsTest.js b/tests/unit/GooglePlacesUtilsTest.js index 4805e180eedc..b94068f521ff 100644 --- a/tests/unit/GooglePlacesUtilsTest.js +++ b/tests/unit/GooglePlacesUtilsTest.js @@ -15,93 +15,6 @@ const objectWithCountryToFind = { country: 'long_name', }; -const bigObjectToFind = { - sublocality: 'long_name', - administrative_area_level_1: 'short_name', - postal_code: 'long_name', - 'doesnt-exist': 'long_name', - s1ublocality: 'long_name', - a1dministrative_area_level_1: 'short_name', - p1ostal_code: 'long_name', - '1doesnt-exist': 'long_name', - s2ublocality: 'long_name', - a2dministrative_area_level_1: 'short_name', - p2ostal_code: 'long_name', - '2doesnt-exist': 'long_name', - s3ublocality: 'long_name', - a3dministrative_area_level_1: 'short_name', - p3ostal_code: 'long_name', - '3doesnt-exist': 'long_name', - s4ublocality: 'long_name', - a4dministrative_area_level_1: 'short_name', - p4ostal_code: 'long_name', - '4doesnt-exist': 'long_name', - s5ublocality: 'long_name', - a5dministrative_area_level_1: 'short_name', - p5ostal_code: 'long_name', - '5doesnt-exist': 'long_name', - s6ublocality: 'long_name', - a6dministrative_area_level_1: 'short_name', - p6ostal_code: 'long_name', - '6doesnt-exist': 'long_name', - s7ublocality: 'long_name', - a7dministrative_area_level_1: 'short_name', - p7ostal_code: 'long_name', - '7doesnt-exist': 'long_name', - s8ublocality: 'long_name', - a8dministrative_area_level_1: 'short_name', - p8ostal_code: 'long_name', - '8doesnt-exist': 'long_name', - s9ublocality: 'long_name', - a9dministrative_area_level_1: 'short_name', - p9ostal_code: 'long_name', - '9doesnt-exist': 'long_name', - s10ublocality: 'long_name', - a10dministrative_area_level_1: 'short_name', - p10ostal_code: 'long_name', - '10doesnt-exist': 'long_name', - s11ublocality: 'long_name', - a11dministrative_area_level_1: 'short_name', - p11ostal_code: 'long_name', - '11doesnt-exist': 'long_name', - s12ublocality: 'long_name', - a12dministrative_area_level_1: 'short_name', - p12ostal_code: 'long_name', - '12doesnt-exist': 'long_name', - s13ublocality: 'long_name', - a13dministrative_area_level_1: 'short_name', - p13ostal_code: 'long_name', - '13doesnt-exist': 'long_name', - s14ublocality: 'long_name', - a14dministrative_area_level_1: 'short_name', - p14ostal_code: 'long_name', - '14doesnt-exist': 'long_name', - s15ublocality: 'long_name', - a15dministrative_area_level_1: 'short_name', - p15ostal_code: 'long_name', - '15doesnt-exist': 'long_name', - s16ublocality: 'long_name', - a16dministrative_area_level_1: 'short_name', - p16ostal_code: 'long_name', - '16doesnt-exist': 'long_name', - s17ublocality: 'long_name', - a17dministrative_area_level_1: 'short_name', - p17ostal_code: 'long_name', - '17doesnt-exist': 'long_name', - s18ublocality: 'long_name', - a18dministrative_area_level_1: 'short_name', - p18ostal_code: 'long_name', - '18doesnt-exist': 'long_name', - s19ublocality: 'long_name', - a19dministrative_area_level_1: 'short_name', - p19ostal_code: 'long_name', - '19doesnt-exist': 'long_name', - s20ublocality: 'long_name', - a20dministrative_area_level_1: 'short_name', - p20ostal_code: 'long_name', - '20doesnt-exist': 'long_name', -}; - const addressComponents = [ { long_name: 'Bushwick', @@ -166,35 +79,6 @@ describe('GooglePlacesUtilsTest', () => { }); }); }); - describe.skip('getAddressComponents small data set timing', () => { - it('should not be slow when executing', () => { - const startTime = performance.now(); - for (let i = 100; i > 0; i--) { - GooglePlacesUtils.getAddressComponents(addressComponents, standardObjectToFind); - } - const endTime = performance.now(); - const executionTime = endTime - startTime; - - // When timing this method it was roughly 0.45087499999999636ms so this would be almost twice as slow - // which I think is a meaningful regression we should avoid - expect(executionTime).toBeLessThan(1.0); - }); - }); - describe.skip('getAddressComponents big data set timing', () => { - it('should not be slow when executing', () => { - const startTime = performance.now(); - for (let i = 100; i > 0; i--) { - GooglePlacesUtils.getAddressComponents(addressComponents, bigObjectToFind); - } - const endTime = performance.now(); - const executionTime = endTime - startTime; - - // When timing this method it was roughly 1.211708999999928ms locally - // but 3.2214480000000094ms on github actions so using 5ms arbitrarily here for now - // and we can change if needed later. - expect(executionTime).toBeLessThan(5.0); - }); - }); describe('getPlaceAutocompleteTerms', () => { it('should find auto complete terms', () => { expect(GooglePlacesUtils.getPlaceAutocompleteTerms(autoCompleteTerms)).toStrictEqual({