From 83252688693a5ad9e9c62583b74f7303e0cc0ff8 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Thu, 29 Feb 2024 16:52:42 +0100 Subject: [PATCH 1/8] fix: move GooglePlacesUtils.perf-test to TS --- ...acesUtils.perf-test.js => GooglePlacesUtils.perf-test.ts} | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) rename tests/perf-test/{GooglePlacesUtils.perf-test.js => GooglePlacesUtils.perf-test.ts} (96%) diff --git a/tests/perf-test/GooglePlacesUtils.perf-test.js b/tests/perf-test/GooglePlacesUtils.perf-test.ts similarity index 96% rename from tests/perf-test/GooglePlacesUtils.perf-test.js rename to tests/perf-test/GooglePlacesUtils.perf-test.ts index 674fb4329205..e1a022a65bf1 100644 --- a/tests/perf-test/GooglePlacesUtils.perf-test.js +++ b/tests/perf-test/GooglePlacesUtils.perf-test.ts @@ -1,7 +1,8 @@ +/* eslint-disable @typescript-eslint/naming-convention */ import {measureFunction} from 'reassure'; import * as GooglePlacesUtils from '../../src/libs/GooglePlacesUtils'; -const addressComponents = [ +const addressComponents: GooglePlacesUtils.AddressComponent[] = [ { long_name: 'Bushwick', short_name: 'Bushwick', @@ -34,7 +35,7 @@ const addressComponents = [ }, ]; -const bigObjectToFind = { +const bigObjectToFind: GooglePlacesUtils.FieldsToExtract = { sublocality: 'long_name', administrative_area_level_1: 'short_name', postal_code: 'long_name', From 17f17f99d090236c4e864c139e9103ccd596517b Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Thu, 29 Feb 2024 17:01:37 +0100 Subject: [PATCH 2/8] ref: move e2e/merge to TS --- tests/e2e/{merge.js => merge.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename tests/e2e/{merge.js => merge.ts} (100%) diff --git a/tests/e2e/merge.js b/tests/e2e/merge.ts similarity index 100% rename from tests/e2e/merge.js rename to tests/e2e/merge.ts From 87ea662f56fc3b7d3fca15e05a052867eae06791 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Thu, 29 Feb 2024 17:30:05 +0100 Subject: [PATCH 3/8] ref: move adbTypeText to TS --- tests/e2e/nativeCommands/{adbTypeText.js => adbTypeText.ts} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename tests/e2e/nativeCommands/{adbTypeText.js => adbTypeText.ts} (83%) diff --git a/tests/e2e/nativeCommands/adbTypeText.js b/tests/e2e/nativeCommands/adbTypeText.ts similarity index 83% rename from tests/e2e/nativeCommands/adbTypeText.js rename to tests/e2e/nativeCommands/adbTypeText.ts index b8c6cfd09c29..de3e6f3592be 100644 --- a/tests/e2e/nativeCommands/adbTypeText.js +++ b/tests/e2e/nativeCommands/adbTypeText.ts @@ -1,7 +1,7 @@ import execAsync from '../utils/execAsync'; import * as Logger from '../utils/logger'; -const adbTypeText = async (text) => { +const adbTypeText = async (text: string) => { Logger.log(`πŸ“ Typing text: ${text}`); execAsync(`adb shell input text "${text}"`); return true; From 139ba7733745ceb4ecf27af387782dcb12bbcbe0 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Thu, 29 Feb 2024 17:31:09 +0100 Subject: [PATCH 4/8] ref: move adbBackspace to TS --- tests/e2e/nativeCommands/{adbBackspace.js => adbBackspace.ts} | 2 +- tests/e2e/nativeCommands/adbTypeText.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename tests/e2e/nativeCommands/{adbBackspace.js => adbBackspace.ts} (77%) diff --git a/tests/e2e/nativeCommands/adbBackspace.js b/tests/e2e/nativeCommands/adbBackspace.ts similarity index 77% rename from tests/e2e/nativeCommands/adbBackspace.js rename to tests/e2e/nativeCommands/adbBackspace.ts index 7b01ed58080d..8f7b3a3f6e14 100644 --- a/tests/e2e/nativeCommands/adbBackspace.js +++ b/tests/e2e/nativeCommands/adbBackspace.ts @@ -3,7 +3,7 @@ import * as Logger from '../utils/logger'; const adbBackspace = async () => { Logger.log(`πŸ”™ Pressing backspace`); - execAsync(`adb shell input keyevent KEYCODE_DEL`); + await execAsync(`adb shell input keyevent KEYCODE_DEL`); return true; }; diff --git a/tests/e2e/nativeCommands/adbTypeText.ts b/tests/e2e/nativeCommands/adbTypeText.ts index de3e6f3592be..4d2fa4044250 100644 --- a/tests/e2e/nativeCommands/adbTypeText.ts +++ b/tests/e2e/nativeCommands/adbTypeText.ts @@ -3,7 +3,7 @@ import * as Logger from '../utils/logger'; const adbTypeText = async (text: string) => { Logger.log(`πŸ“ Typing text: ${text}`); - execAsync(`adb shell input text "${text}"`); + await execAsync(`adb shell input text "${text}"`); return true; }; From 3fb82d4fcd58885d21b4ef25ab6950a1b39c8a69 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Thu, 29 Feb 2024 18:07:13 +0100 Subject: [PATCH 5/8] ref: move removeInvisibleCharacters to TS --- ...moveInvisibleCharacters.js => removeInvisibleCharacters.ts} | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) rename tests/unit/{removeInvisibleCharacters.js => removeInvisibleCharacters.ts} (99%) diff --git a/tests/unit/removeInvisibleCharacters.js b/tests/unit/removeInvisibleCharacters.ts similarity index 99% rename from tests/unit/removeInvisibleCharacters.js rename to tests/unit/removeInvisibleCharacters.ts index 98d1c7c71baf..a036f89b74f2 100644 --- a/tests/unit/removeInvisibleCharacters.js +++ b/tests/unit/removeInvisibleCharacters.ts @@ -1,4 +1,3 @@ -import _ from 'underscore'; import enEmojis from '../../assets/emojis/en'; import StringUtils from '../../src/libs/StringUtils'; @@ -80,7 +79,7 @@ describe('libs/StringUtils.removeInvisibleCharacters', () => { expect(StringUtils.removeInvisibleCharacters('testπŸ˜€πŸ˜€πŸ˜€')).toBe('testπŸ˜€πŸ˜€πŸ˜€'); }); it('all emojis not removed', () => { - _.keys(enEmojis).forEach((key) => { + Object.keys(enEmojis).forEach((key) => { expect(StringUtils.removeInvisibleCharacters(key)).toBe(key); }); }); From d49085d2ce5c40dd0491f6745741c96ff00d16f1 Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Mon, 4 Mar 2024 15:13:36 +0100 Subject: [PATCH 6/8] fix --- tests/e2e/nativeCommands/adbBackspace.ts | 3 ++- tests/e2e/nativeCommands/adbTypeText.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/e2e/nativeCommands/adbBackspace.ts b/tests/e2e/nativeCommands/adbBackspace.ts index 8f7b3a3f6e14..890156d55e80 100644 --- a/tests/e2e/nativeCommands/adbBackspace.ts +++ b/tests/e2e/nativeCommands/adbBackspace.ts @@ -1,9 +1,10 @@ import execAsync from '../utils/execAsync'; import * as Logger from '../utils/logger'; +// eslint-disable-next-line @typescript-eslint/require-await const adbBackspace = async () => { Logger.log(`πŸ”™ Pressing backspace`); - await execAsync(`adb shell input keyevent KEYCODE_DEL`); + execAsync(`adb shell input keyevent KEYCODE_DEL`); return true; }; diff --git a/tests/e2e/nativeCommands/adbTypeText.ts b/tests/e2e/nativeCommands/adbTypeText.ts index 4d2fa4044250..d12629b5542b 100644 --- a/tests/e2e/nativeCommands/adbTypeText.ts +++ b/tests/e2e/nativeCommands/adbTypeText.ts @@ -1,9 +1,10 @@ import execAsync from '../utils/execAsync'; import * as Logger from '../utils/logger'; +// eslint-disable-next-line @typescript-eslint/require-await const adbTypeText = async (text: string) => { Logger.log(`πŸ“ Typing text: ${text}`); - await execAsync(`adb shell input text "${text}"`); + execAsync(`adb shell input text "${text}"`); return true; }; From 8e55e46d32b4ae00c0e837cfd94028ee9d49907b Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Thu, 7 Mar 2024 11:12:52 +0100 Subject: [PATCH 7/8] fix: resolve review comments --- tests/e2e/nativeCommands/adbBackspace.ts | 2 +- tests/e2e/nativeCommands/adbTypeText.ts | 2 +- tests/e2e/server/index.ts | 19 +++++++++---------- .../perf-test/GooglePlacesUtils.perf-test.ts | 2 +- tests/unit/removeInvisibleCharacters.ts | 4 ++-- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/tests/e2e/nativeCommands/adbBackspace.ts b/tests/e2e/nativeCommands/adbBackspace.ts index 890156d55e80..8ed8b46aebee 100644 --- a/tests/e2e/nativeCommands/adbBackspace.ts +++ b/tests/e2e/nativeCommands/adbBackspace.ts @@ -2,7 +2,7 @@ import execAsync from '../utils/execAsync'; import * as Logger from '../utils/logger'; // eslint-disable-next-line @typescript-eslint/require-await -const adbBackspace = async () => { +const adbBackspace = () => { Logger.log(`πŸ”™ Pressing backspace`); execAsync(`adb shell input keyevent KEYCODE_DEL`); return true; diff --git a/tests/e2e/nativeCommands/adbTypeText.ts b/tests/e2e/nativeCommands/adbTypeText.ts index d12629b5542b..32cb5e80b626 100644 --- a/tests/e2e/nativeCommands/adbTypeText.ts +++ b/tests/e2e/nativeCommands/adbTypeText.ts @@ -2,7 +2,7 @@ import execAsync from '../utils/execAsync'; import * as Logger from '../utils/logger'; // eslint-disable-next-line @typescript-eslint/require-await -const adbTypeText = async (text: string) => { +const adbTypeText = (text: string) => { Logger.log(`πŸ“ Typing text: ${text}`); execAsync(`adb shell input text "${text}"`); return true; diff --git a/tests/e2e/server/index.ts b/tests/e2e/server/index.ts index 7e7c34959655..1827f507c496 100644 --- a/tests/e2e/server/index.ts +++ b/tests/e2e/server/index.ts @@ -139,16 +139,15 @@ const createServerInstance = (): ServerInstance => { case Routes.testNativeCommand: { getPostJSONRequestData(req, res) - ?.then((data) => - nativeCommands.executeFromPayload(data?.actionName, data?.payload).then((status) => { - if (status) { - res.end('ok'); - return; - } - res.statusCode = 500; - res.end('Error executing command'); - }), - ) + ?.then((data) => { + const status = nativeCommands.executeFromPayload(data?.actionName, data?.payload); + if (status) { + res.end('ok'); + return; + } + res.statusCode = 500; + res.end('Error executing command'); + }) .catch((error) => { Logger.error('Error executing command', error); res.statusCode = 500; diff --git a/tests/perf-test/GooglePlacesUtils.perf-test.ts b/tests/perf-test/GooglePlacesUtils.perf-test.ts index e1a022a65bf1..1dd64feb23e0 100644 --- a/tests/perf-test/GooglePlacesUtils.perf-test.ts +++ b/tests/perf-test/GooglePlacesUtils.perf-test.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/naming-convention */ import {measureFunction} from 'reassure'; -import * as GooglePlacesUtils from '../../src/libs/GooglePlacesUtils'; +import * as GooglePlacesUtils from '@src/libs/GooglePlacesUtils'; const addressComponents: GooglePlacesUtils.AddressComponent[] = [ { diff --git a/tests/unit/removeInvisibleCharacters.ts b/tests/unit/removeInvisibleCharacters.ts index a036f89b74f2..8294b8cefc5f 100644 --- a/tests/unit/removeInvisibleCharacters.ts +++ b/tests/unit/removeInvisibleCharacters.ts @@ -1,5 +1,5 @@ -import enEmojis from '../../assets/emojis/en'; -import StringUtils from '../../src/libs/StringUtils'; +import enEmojis from '@assets/emojis/en'; +import StringUtils from '@src/libs/StringUtils'; describe('libs/StringUtils.removeInvisibleCharacters', () => { it('basic tests', () => { From 35417c6e2fee1a9477a2692caa206ce8c000df7b Mon Sep 17 00:00:00 2001 From: Jakub Butkiewicz Date: Fri, 8 Mar 2024 13:55:32 +0100 Subject: [PATCH 8/8] fix: remove unnecessary comments --- tests/e2e/nativeCommands/adbBackspace.ts | 1 - tests/e2e/nativeCommands/adbTypeText.ts | 1 - 2 files changed, 2 deletions(-) diff --git a/tests/e2e/nativeCommands/adbBackspace.ts b/tests/e2e/nativeCommands/adbBackspace.ts index 8ed8b46aebee..2891d1daf0e9 100644 --- a/tests/e2e/nativeCommands/adbBackspace.ts +++ b/tests/e2e/nativeCommands/adbBackspace.ts @@ -1,7 +1,6 @@ import execAsync from '../utils/execAsync'; import * as Logger from '../utils/logger'; -// eslint-disable-next-line @typescript-eslint/require-await const adbBackspace = () => { Logger.log(`πŸ”™ Pressing backspace`); execAsync(`adb shell input keyevent KEYCODE_DEL`); diff --git a/tests/e2e/nativeCommands/adbTypeText.ts b/tests/e2e/nativeCommands/adbTypeText.ts index 32cb5e80b626..72fefbd25d26 100644 --- a/tests/e2e/nativeCommands/adbTypeText.ts +++ b/tests/e2e/nativeCommands/adbTypeText.ts @@ -1,7 +1,6 @@ import execAsync from '../utils/execAsync'; import * as Logger from '../utils/logger'; -// eslint-disable-next-line @typescript-eslint/require-await const adbTypeText = (text: string) => { Logger.log(`πŸ“ Typing text: ${text}`); execAsync(`adb shell input text "${text}"`);