From f3a35ddbfd6eb4821b9bbddf61e705bb396e656e Mon Sep 17 00:00:00 2001 From: Yauheni Pasiukevich Date: Tue, 19 Mar 2024 15:13:48 +0100 Subject: [PATCH 1/3] [TS migration] Migrate remaining Test files to TypeScript #38536 --- src/libs/E2E/client.ts | 2 +- tests/e2e/nativeCommands/{index.js => index.ts} | 5 +++-- tests/unit/{LocaleCompareTest.js => LocaleCompareTest.ts} | 0 ...archCountryOptionsTest.js => searchCountryOptionsTest.ts} | 0 4 files changed, 4 insertions(+), 3 deletions(-) rename tests/e2e/nativeCommands/{index.js => index.ts} (75%) rename tests/unit/{LocaleCompareTest.js => LocaleCompareTest.ts} (100%) rename tests/unit/{searchCountryOptionsTest.js => searchCountryOptionsTest.ts} (100%) diff --git a/src/libs/E2E/client.ts b/src/libs/E2E/client.ts index 4c0e572cc9b2..5aa999267ead 100644 --- a/src/libs/E2E/client.ts +++ b/src/libs/E2E/client.ts @@ -105,4 +105,4 @@ export default { updateNetworkCache, getNetworkCache, }; -export type {TestResult, NativeCommand}; +export type {TestResult, NativeCommand, NativeCommandPayload}; diff --git a/tests/e2e/nativeCommands/index.js b/tests/e2e/nativeCommands/index.ts similarity index 75% rename from tests/e2e/nativeCommands/index.js rename to tests/e2e/nativeCommands/index.ts index 90dcb00bbcae..09d727b5d257 100644 --- a/tests/e2e/nativeCommands/index.js +++ b/tests/e2e/nativeCommands/index.ts @@ -1,14 +1,15 @@ +import type {NativeCommandPayload} from '@libs/E2E/client'; import adbBackspace from './adbBackspace'; import adbTypeText from './adbTypeText'; // eslint-disable-next-line rulesdir/prefer-import-module-contents import {NativeCommandsAction} from './NativeCommandsAction'; -const executeFromPayload = (actionName, payload) => { +const executeFromPayload = (actionName?: string, payload?: NativeCommandPayload) => { switch (actionName) { case NativeCommandsAction.scroll: throw new Error('Not implemented yet'); case NativeCommandsAction.type: - return adbTypeText(payload.text); + return adbTypeText(payload?.text ?? ''); case NativeCommandsAction.backspace: return adbBackspace(); default: diff --git a/tests/unit/LocaleCompareTest.js b/tests/unit/LocaleCompareTest.ts similarity index 100% rename from tests/unit/LocaleCompareTest.js rename to tests/unit/LocaleCompareTest.ts diff --git a/tests/unit/searchCountryOptionsTest.js b/tests/unit/searchCountryOptionsTest.ts similarity index 100% rename from tests/unit/searchCountryOptionsTest.js rename to tests/unit/searchCountryOptionsTest.ts From 910a31671de0f4a2b13d2db710c3371331035dab Mon Sep 17 00:00:00 2001 From: Yauheni Pasiukevich Date: Tue, 19 Mar 2024 15:26:04 +0100 Subject: [PATCH 2/3] fix main --- src/pages/EnablePayments/OnfidoStep.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/pages/EnablePayments/OnfidoStep.tsx b/src/pages/EnablePayments/OnfidoStep.tsx index 46c6e1c8e6ed..3ebcdad40c37 100644 --- a/src/pages/EnablePayments/OnfidoStep.tsx +++ b/src/pages/EnablePayments/OnfidoStep.tsx @@ -3,7 +3,6 @@ import {withOnyx} from 'react-native-onyx'; import type {OnyxEntry} from 'react-native-onyx'; import FullPageOfflineBlockingView from '@components/BlockingViews/FullPageOfflineBlockingView'; import HeaderWithBackButton from '@components/HeaderWithBackButton'; -// @ts-expect-error TODO: Remove this once Onfido (https://github.com/Expensify/App/issues/25136) is migrated to TypeScript. import Onfido from '@components/Onfido'; import useLocalize from '@hooks/useLocalize'; import Growl from '@libs/Growl'; @@ -66,7 +65,7 @@ function OnfidoStep({walletOnfidoData = DEFAULT_WALLET_ONFIDO_DATA}: OnfidoStepP {shouldShowOnfido ? ( Date: Tue, 19 Mar 2024 15:57:01 +0100 Subject: [PATCH 3/3] add return type --- tests/e2e/nativeCommands/index.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/e2e/nativeCommands/index.ts b/tests/e2e/nativeCommands/index.ts index 09d727b5d257..31af618c8ec1 100644 --- a/tests/e2e/nativeCommands/index.ts +++ b/tests/e2e/nativeCommands/index.ts @@ -4,7 +4,7 @@ import adbTypeText from './adbTypeText'; // eslint-disable-next-line rulesdir/prefer-import-module-contents import {NativeCommandsAction} from './NativeCommandsAction'; -const executeFromPayload = (actionName?: string, payload?: NativeCommandPayload) => { +const executeFromPayload = (actionName?: string, payload?: NativeCommandPayload): boolean => { switch (actionName) { case NativeCommandsAction.scroll: throw new Error('Not implemented yet');