From 5dc99332726b2c824f049bd95f04a2ed612c0e0e Mon Sep 17 00:00:00 2001 From: Yuwen Memon Date: Thu, 17 Sep 2026 09:51:51 -0700 Subject: [PATCH 1/2] fix(netsuite): remove expensify 2fa requirement from oauth setup --- src/languages/de.ts | 1 - src/languages/el.ts | 1 - src/languages/en.ts | 1 - src/languages/es.ts | 1 - src/languages/fr.ts | 1 - src/languages/it.ts | 1 - src/languages/ja.ts | 1 - src/languages/nl.ts | 1 - src/languages/pl.ts | 1 - src/languages/pt-BR.ts | 1 - src/languages/zh-hans.ts | 1 - .../subPages/NetSuiteTokenInputForm.tsx | 26 +------- .../netsuite/NetSuiteTokenInputFormTest.tsx | 63 ++----------------- 13 files changed, 6 insertions(+), 94 deletions(-) diff --git a/src/languages/de.ts b/src/languages/de.ts index 19902a27a301..b9db374bcb21 100644 --- a/src/languages/de.ts +++ b/src/languages/de.ts @@ -2543,7 +2543,6 @@ const translations: TranslationDeepObject = { verifyNewDeviceDescription: 'Scannen Sie den QR-Code mit Ihrem neuen Gerät und geben Sie dann den Code ein, um die Einrichtung abzuschließen.', downloadCodes: 'Codes herunterladen', copyCodes: 'Codes kopieren', - twoFactorAuthIsRequiredNetSuiteDescription: 'Aus Sicherheitsgründen erfordert NetSuite zur Verbindung der Integration eine Zwei-Faktor-Authentifizierung.', }, recoveryCodeForm: { error: { diff --git a/src/languages/el.ts b/src/languages/el.ts index 2a23dd7331cc..bcd1333b09f7 100644 --- a/src/languages/el.ts +++ b/src/languages/el.ts @@ -2599,7 +2599,6 @@ const translations: TranslationDeepObject = { verifyOldDeviceDescriptionWithRecovery: 'Εισαγάγετε έναν έγκυρο κωδικό ανάκτησης για να επιβεβαιώσετε ότι έχετε πρόσβαση στον λογαριασμό σας.', verifyNewDeviceTitle: 'Ρύθμιση νέας συσκευής', verifyNewDeviceDescription: 'Σαρώστε τον κωδικό QR με τη νέα σας συσκευή και κατόπιν εισαγάγετε τον κωδικό για να ολοκληρώσετε τη ρύθμιση.', - twoFactorAuthIsRequiredNetSuiteDescription: 'Για λόγους ασφαλείας, το NetSuite απαιτεί έλεγχο ταυτότητας δύο παραγόντων για τη σύνδεση της ενοποίησης.', }, recoveryCodeForm: { error: { diff --git a/src/languages/en.ts b/src/languages/en.ts index 0ef43166c5a8..71b58f27b3fd 100644 --- a/src/languages/en.ts +++ b/src/languages/en.ts @@ -2632,7 +2632,6 @@ const translations = { enableTwoFactorAuth: 'Enable two-factor authentication', pleaseEnableTwoFactorAuth: 'Please enable two-factor authentication.', twoFactorAuthIsRequiredDescription: 'For security purposes, Xero requires two-factor authentication to connect the integration.', - twoFactorAuthIsRequiredNetSuiteDescription: 'For security purposes, NetSuite requires two-factor authentication to connect the integration.', twoFactorAuthIsRequiredForAdminsHeader: 'Two-factor authentication required', twoFactorAuthIsRequiredForAdminsTitle: 'Please enable two-factor authentication', twoFactorAuthIsRequiredXero: 'Your Xero accounting connection requires two-factor authentication.', diff --git a/src/languages/es.ts b/src/languages/es.ts index d12a9d4bd654..f39e91886325 100644 --- a/src/languages/es.ts +++ b/src/languages/es.ts @@ -2463,7 +2463,6 @@ const translations: TranslationDeepObject = { verifyNewDeviceDescription: 'Escanea el código QR con tu nuevo dispositivo y luego introduce el código para completar la configuración.', downloadCodes: 'Descargar códigos', copyCodes: 'Copiar códigos', - twoFactorAuthIsRequiredNetSuiteDescription: 'Por motivos de seguridad, NetSuite requiere autenticación de dos factores para conectar la integración.', }, recoveryCodeForm: { error: { diff --git a/src/languages/fr.ts b/src/languages/fr.ts index 0cc708fbb6e2..5a25d318f82e 100644 --- a/src/languages/fr.ts +++ b/src/languages/fr.ts @@ -2547,7 +2547,6 @@ const translations: TranslationDeepObject = { verifyNewDeviceDescription: 'Scannez le code QR avec votre nouvel appareil, puis saisissez le code pour terminer la configuration.', downloadCodes: 'Télécharger les codes', copyCodes: 'Copier les codes', - twoFactorAuthIsRequiredNetSuiteDescription: "Pour des raisons de sécurité, NetSuite exige une authentification à deux facteurs pour connecter l'intégration.", }, recoveryCodeForm: { error: { diff --git a/src/languages/it.ts b/src/languages/it.ts index 0ae3b3123139..11d3cbe7b216 100644 --- a/src/languages/it.ts +++ b/src/languages/it.ts @@ -2534,7 +2534,6 @@ const translations: TranslationDeepObject = { verifyNewDeviceDescription: 'Scansiona il codice QR con il tuo nuovo dispositivo, poi inserisci il codice per completare la configurazione.', downloadCodes: 'Scarica codici', copyCodes: 'Copia codici', - twoFactorAuthIsRequiredNetSuiteDescription: 'Per motivi di sicurezza, NetSuite richiede l’autenticazione a due fattori per collegare l’integrazione.', }, recoveryCodeForm: { error: { diff --git a/src/languages/ja.ts b/src/languages/ja.ts index 96ed7da8cba3..83c5b9f55ae9 100644 --- a/src/languages/ja.ts +++ b/src/languages/ja.ts @@ -2516,7 +2516,6 @@ const translations: TranslationDeepObject = { verifyNewDeviceDescription: '新しいデバイスでQRコードをスキャンし、表示されたコードを入力して設定を完了してください。', downloadCodes: 'コードをダウンロード', copyCodes: 'コードをコピー', - twoFactorAuthIsRequiredNetSuiteDescription: 'セキュリティ上の理由により、連携を接続するには NetSuite で二要素認証が必要です。', }, recoveryCodeForm: { error: { diff --git a/src/languages/nl.ts b/src/languages/nl.ts index 5a37849d9888..f758731019d3 100644 --- a/src/languages/nl.ts +++ b/src/languages/nl.ts @@ -2535,7 +2535,6 @@ const translations: TranslationDeepObject = { verifyNewDeviceDescription: 'Scan de QR-code met je nieuwe apparaat en voer daarna de code in om de installatie te voltooien.', downloadCodes: 'Codes downloaden', copyCodes: 'Codes kopiëren', - twoFactorAuthIsRequiredNetSuiteDescription: 'Om veiligheidsredenen vereist NetSuite tweeledige verificatie om de koppeling te maken.', }, recoveryCodeForm: { error: { diff --git a/src/languages/pl.ts b/src/languages/pl.ts index 493be1c816f9..56b0163323da 100644 --- a/src/languages/pl.ts +++ b/src/languages/pl.ts @@ -2572,7 +2572,6 @@ const translations: TranslationDeepObject = { verifyNewDeviceDescription: 'Zeskanuj kod QR nowym urządzeniem, a następnie wpisz ten kod, aby zakończyć konfigurację.', downloadCodes: 'Pobierz kody', copyCodes: 'Skopiuj kody', - twoFactorAuthIsRequiredNetSuiteDescription: 'Ze względów bezpieczeństwa NetSuite wymaga uwierzytelniania dwuskładnikowego, aby połączyć integrację.', }, recoveryCodeForm: { error: { diff --git a/src/languages/pt-BR.ts b/src/languages/pt-BR.ts index 7f18e5414f6e..2bdd7d01d016 100644 --- a/src/languages/pt-BR.ts +++ b/src/languages/pt-BR.ts @@ -2528,7 +2528,6 @@ const translations: TranslationDeepObject = { verifyNewDeviceDescription: 'Escaneie o código QR com seu novo dispositivo e depois insira o código para concluir a configuração.', downloadCodes: 'Baixar códigos', copyCodes: 'Copiar códigos', - twoFactorAuthIsRequiredNetSuiteDescription: 'Por motivos de segurança, o NetSuite exige autenticação em duas etapas para conectar a integração.', }, recoveryCodeForm: { error: { diff --git a/src/languages/zh-hans.ts b/src/languages/zh-hans.ts index 2ed5c9fde02f..4d8def923bef 100644 --- a/src/languages/zh-hans.ts +++ b/src/languages/zh-hans.ts @@ -2451,7 +2451,6 @@ const translations: TranslationDeepObject = { verifyNewDeviceDescription: '使用新设备扫描二维码,然后输入代码完成设置。', downloadCodes: '下载代码', copyCodes: '复制代码', - twoFactorAuthIsRequiredNetSuiteDescription: '出于安全考虑,NetSuite 要求使用双重身份验证来连接此集成。', }, recoveryCodeForm: { error: { diff --git a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/subPages/NetSuiteTokenInputForm.tsx b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/subPages/NetSuiteTokenInputForm.tsx index 1fa21d0e28c8..349626cb3998 100644 --- a/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/subPages/NetSuiteTokenInputForm.tsx +++ b/src/pages/workspace/accounting/netsuite/NetSuiteTokenInput/subPages/NetSuiteTokenInputForm.tsx @@ -2,7 +2,6 @@ import FormProvider from '@components/Form/FormProvider'; import InputWrapper from '@components/Form/InputWrapper'; import type {FormInputErrors, FormOnyxValues} from '@components/Form/types'; import RenderHTML from '@components/RenderHTML'; -import RequireTwoFactorAuthenticationModal from '@components/RequireTwoFactorAuthenticationModal'; import Text from '@components/Text'; import TextInput from '@components/TextInput'; @@ -12,13 +11,11 @@ import useLocalize from '@hooks/useLocalize'; import usePermissions from '@hooks/usePermissions'; import usePolicy from '@hooks/usePolicy'; import useThemeStyles from '@hooks/useThemeStyles'; -import useTwoFactorAuthRoute from '@hooks/useTwoFactorAuthRoute'; import {shouldUseUpdateNetSuiteTokens} from '@libs/actions/connections'; import {connectPolicyToNetSuite, updateNetSuiteTokens} from '@libs/actions/connections/NetSuiteCommands'; import {isMobileSafari} from '@libs/Browser'; import {addErrorMessage} from '@libs/ErrorUtils'; -import Navigation from '@libs/Navigation/Navigation'; import Parser from '@libs/Parser'; import type {CustomSubPageTokenInputProps} from '@pages/workspace/accounting/netsuite/types'; @@ -27,7 +24,7 @@ import CONST from '@src/CONST'; import ONYXKEYS from '@src/ONYXKEYS'; import INPUT_IDS from '@src/types/form/NetSuiteTokenInputForm'; -import React, {useCallback, useState} from 'react'; +import React, {useCallback} from 'react'; import {View} from 'react-native'; import connectToNetSuiteOAuthSetup from './connectToNetSuiteOAuthSetup'; @@ -39,10 +36,8 @@ function NetSuiteTokenInputForm({onNext, policyID}: CustomSubPageTokenInputProps const {inputCallbackRef} = useAutoFocusInput(); const {isBetaEnabled} = usePermissions(); const {environmentURL} = useEnvironment(); - const {is2FAEnabled, getTwoFactorAuthRoute} = useTwoFactorAuthRoute(); const isOAuthFlow = isBetaEnabled(CONST.BETAS.NETSUITE_OAUTH); - const [isRequire2FAModalOpen, setIsRequire2FAModalOpen] = useState(false); const formInputs = isOAuthFlow ? [INPUT_IDS.NETSUITE_ACCOUNT_ID] : Object.values(INPUT_IDS); @@ -68,10 +63,6 @@ function NetSuiteTokenInputForm({onNext, policyID}: CustomSubPageTokenInputProps } if (isOAuthFlow) { - if (!is2FAEnabled) { - setIsRequire2FAModalOpen(true); - return; - } connectToNetSuiteOAuthSetup(policyID, formValues[INPUT_IDS.NETSUITE_ACCOUNT_ID], environmentURL); return; } @@ -83,7 +74,7 @@ function NetSuiteTokenInputForm({onNext, policyID}: CustomSubPageTokenInputProps } onNext(); }, - [onNext, policyID, policy, isOAuthFlow, is2FAEnabled, environmentURL], + [onNext, policyID, policy, isOAuthFlow, environmentURL], ); return ( @@ -127,19 +118,6 @@ function NetSuiteTokenInputForm({onNext, policyID}: CustomSubPageTokenInputProps ))} - {isOAuthFlow && !is2FAEnabled && ( - { - setIsRequire2FAModalOpen(false); - Navigation.navigate(getTwoFactorAuthRoute()); - }} - onCancel={() => { - setIsRequire2FAModalOpen(false); - }} - isVisible={isRequire2FAModalOpen} - description={translate('twoFactorAuth.twoFactorAuthIsRequiredNetSuiteDescription')} - /> - )} ); } diff --git a/tests/unit/pages/workspace/accounting/netsuite/NetSuiteTokenInputFormTest.tsx b/tests/unit/pages/workspace/accounting/netsuite/NetSuiteTokenInputFormTest.tsx index 77e8210c5021..be9bd4202415 100644 --- a/tests/unit/pages/workspace/accounting/netsuite/NetSuiteTokenInputFormTest.tsx +++ b/tests/unit/pages/workspace/accounting/netsuite/NetSuiteTokenInputFormTest.tsx @@ -5,7 +5,6 @@ import useTwoFactorAuthRoute from '@hooks/useTwoFactorAuthRoute'; import {shouldUseUpdateNetSuiteTokens} from '@libs/actions/connections'; import {connectPolicyToNetSuite, updateNetSuiteTokens} from '@libs/actions/connections/NetSuiteCommands'; -import Navigation from '@libs/Navigation/Navigation'; import connectToNetSuiteOAuthSetup from '@pages/workspace/accounting/netsuite/NetSuiteTokenInput/subPages/connectToNetSuiteOAuthSetup'; import NetSuiteTokenInputForm from '@pages/workspace/accounting/netsuite/NetSuiteTokenInput/subPages/NetSuiteTokenInputForm'; @@ -30,16 +29,10 @@ const FORM_VALUES = { netSuiteTokenSecret: TOKEN_SECRET, } as NetSuiteTokenInputFormType; -type Require2FAProps = { - isVisible: boolean; - onSubmit: () => void; - onCancel: () => void; -}; - // `Mock`-prefixed bindings are allowed inside jest.mock factories, unlike regular imports. const MockView = View; -// Capture the props of the mocked children so the tests can drive submission and the modal. +// Capture the form props to submit credentials in tests. type MockFormProviderProps = { children: React.ReactNode; onSubmit: (values: NetSuiteTokenInputFormType) => void; @@ -51,9 +44,6 @@ type MockFormProviderProps = { const mockFormProps: {current: Omit | undefined} = { current: undefined, }; -const mockRequire2FAProps: {current: Require2FAProps | undefined} = { - current: undefined, -}; jest.mock('@hooks/useLocalize', () => () => ({ translate: (key: string) => key, @@ -86,9 +76,6 @@ jest.mock('@libs/actions/connections/NetSuiteCommands', () => ({ updateNetSuiteTokens: jest.fn(), })); jest.mock('@pages/workspace/accounting/netsuite/NetSuiteTokenInput/subPages/connectToNetSuiteOAuthSetup', () => jest.fn()); -jest.mock('@libs/Navigation/Navigation', () => ({ - navigate: jest.fn(), -})); jest.mock('@components/RenderHTML', () => () => null); jest.mock('@components/Form/FormProvider', () => { function MockFormProvider({children, onSubmit, keyboardSubmitBehavior, shouldShowLoadingImmediatelyOnPress, submitButtonText}: MockFormProviderProps) { @@ -98,10 +85,7 @@ jest.mock('@components/Form/FormProvider', () => { return MockFormProvider; }); jest.mock('@components/Form/InputWrapper', () => () => null); -jest.mock('@components/RequireTwoFactorAuthenticationModal', () => ({isVisible, onSubmit, onCancel}: Require2FAProps) => { - mockRequire2FAProps.current = {isVisible, onSubmit, onCancel}; - return isVisible ? : null; -}); +jest.mock('@components/RequireTwoFactorAuthenticationModal', () => () => ); const mockedUsePermissions = jest.mocked(usePermissions); const mockedUseTwoFactorAuthRoute = jest.mocked(useTwoFactorAuthRoute); @@ -109,7 +93,6 @@ const mockedShouldUseUpdateNetSuiteTokens = jest.mocked(shouldUseUpdateNetSuiteT const mockedConnectPolicyToNetSuite = jest.mocked(connectPolicyToNetSuite); const mockedUpdateNetSuiteTokens = jest.mocked(updateNetSuiteTokens); const mockedConnectToNetSuiteOAuthSetup = jest.mocked(connectToNetSuiteOAuthSetup); -const mockedNavigate = jest.mocked(Navigation.navigate); const mockedGetTwoFactorAuthRoute = jest.fn(() => TWO_FACTOR_AUTH_ROUTE); const mockedOnNext = jest.fn(); @@ -146,15 +129,14 @@ describe('NetSuiteTokenInputForm', () => { beforeEach(() => { jest.clearAllMocks(); mockFormProps.current = undefined; - mockRequire2FAProps.current = undefined; mockedGetTwoFactorAuthRoute.mockReturnValue(TWO_FACTOR_AUTH_ROUTE); mockedShouldUseUpdateNetSuiteTokens.mockReturnValue(false); }); - describe('when the netSuiteOAuth beta is enabled and 2FA is enabled', () => { + describe.each([true, false])('when the netSuiteOAuth beta is enabled and 2FA enabled is %s', (is2FAEnabled) => { beforeEach(() => { setBetaEnabled(true); - set2FAEnabled(true); + set2FAEnabled(is2FAEnabled); }); it('hands off to the OAuth setup with the policy, account ID and environment URL', () => { @@ -202,43 +184,6 @@ describe('NetSuiteTokenInputForm', () => { }); }); - describe('when the netSuiteOAuth beta is enabled and 2FA is not enabled', () => { - beforeEach(() => { - setBetaEnabled(true); - set2FAEnabled(false); - }); - - it('blocks the OAuth handoff and shows the 2FA requirement modal', () => { - renderForm(); - submitForm(); - - expect(screen.getByTestId('require-2fa-modal')).toBeOnTheScreen(); - expect(mockedConnectToNetSuiteOAuthSetup).not.toHaveBeenCalled(); - }); - - it('navigates to the 2FA route when the modal is submitted', () => { - renderForm(); - submitForm(); - expect(screen.getByTestId('require-2fa-modal')).toBeOnTheScreen(); - - act(() => mockRequire2FAProps.current?.onSubmit()); - - expect(mockedGetTwoFactorAuthRoute).toHaveBeenCalled(); - expect(mockedNavigate).toHaveBeenCalledWith(TWO_FACTOR_AUTH_ROUTE); - }); - - it('closes the modal without navigating when cancelled', () => { - renderForm(); - submitForm(); - expect(screen.getByTestId('require-2fa-modal')).toBeOnTheScreen(); - - act(() => mockRequire2FAProps.current?.onCancel()); - - expect(mockedNavigate).not.toHaveBeenCalled(); - expect(screen.queryByTestId('require-2fa-modal')).toBeNull(); - }); - }); - describe('when the netSuiteOAuth beta is disabled', () => { beforeEach(() => { setBetaEnabled(false); From d50ba1a8efb6783cb26d71ea68e55389f5f385fd Mon Sep 17 00:00:00 2001 From: Yuwen Memon Date: Thu, 17 Sep 2026 22:38:42 -0700 Subject: [PATCH 2/2] test(netsuite): remove obsolete 2fa test scaffolding --- .../netsuite/NetSuiteTokenInputFormTest.tsx | 35 ++----------------- 1 file changed, 3 insertions(+), 32 deletions(-) diff --git a/tests/unit/pages/workspace/accounting/netsuite/NetSuiteTokenInputFormTest.tsx b/tests/unit/pages/workspace/accounting/netsuite/NetSuiteTokenInputFormTest.tsx index be9bd4202415..b5317c8ca769 100644 --- a/tests/unit/pages/workspace/accounting/netsuite/NetSuiteTokenInputFormTest.tsx +++ b/tests/unit/pages/workspace/accounting/netsuite/NetSuiteTokenInputFormTest.tsx @@ -1,7 +1,6 @@ -import {act, render, screen} from '@testing-library/react-native'; +import {act, render} from '@testing-library/react-native'; import usePermissions from '@hooks/usePermissions'; -import useTwoFactorAuthRoute from '@hooks/useTwoFactorAuthRoute'; import {shouldUseUpdateNetSuiteTokens} from '@libs/actions/connections'; import {connectPolicyToNetSuite, updateNetSuiteTokens} from '@libs/actions/connections/NetSuiteCommands'; @@ -10,18 +9,15 @@ import connectToNetSuiteOAuthSetup from '@pages/workspace/accounting/netsuite/Ne import NetSuiteTokenInputForm from '@pages/workspace/accounting/netsuite/NetSuiteTokenInput/subPages/NetSuiteTokenInputForm'; import CONST from '@src/CONST'; -import ROUTES from '@src/ROUTES'; import type {NetSuiteTokenInputForm as NetSuiteTokenInputFormType} from '@src/types/form/NetSuiteTokenInputForm'; import React from 'react'; -import {View} from 'react-native'; const POLICY_ID = '123'; const ACCOUNT_ID = 'TSTDRV1234567'; const TOKEN_ID = 'token-123'; const TOKEN_SECRET = 'secret-123'; const ENVIRONMENT_URL = 'https://new.expensify.com'; -const TWO_FACTOR_AUTH_ROUTE = ROUTES.SETTINGS_2FA_ENABLED; const FORM_VALUES = { netSuiteAccountID: ACCOUNT_ID, @@ -29,9 +25,6 @@ const FORM_VALUES = { netSuiteTokenSecret: TOKEN_SECRET, } as NetSuiteTokenInputFormType; -// `Mock`-prefixed bindings are allowed inside jest.mock factories, unlike regular imports. -const MockView = View; - // Capture the form props to submit credentials in tests. type MockFormProviderProps = { children: React.ReactNode; @@ -67,7 +60,6 @@ jest.mock('@hooks/useAutoFocusInput', () => () => ({ })); jest.mock('@hooks/usePolicy', () => () => undefined); jest.mock('@hooks/usePermissions'); -jest.mock('@hooks/useTwoFactorAuthRoute'); jest.mock('@libs/actions/connections', () => ({ shouldUseUpdateNetSuiteTokens: jest.fn(() => false), })); @@ -85,15 +77,12 @@ jest.mock('@components/Form/FormProvider', () => { return MockFormProvider; }); jest.mock('@components/Form/InputWrapper', () => () => null); -jest.mock('@components/RequireTwoFactorAuthenticationModal', () => () => ); const mockedUsePermissions = jest.mocked(usePermissions); -const mockedUseTwoFactorAuthRoute = jest.mocked(useTwoFactorAuthRoute); const mockedShouldUseUpdateNetSuiteTokens = jest.mocked(shouldUseUpdateNetSuiteTokens); const mockedConnectPolicyToNetSuite = jest.mocked(connectPolicyToNetSuite); const mockedUpdateNetSuiteTokens = jest.mocked(updateNetSuiteTokens); const mockedConnectToNetSuiteOAuthSetup = jest.mocked(connectToNetSuiteOAuthSetup); -const mockedGetTwoFactorAuthRoute = jest.fn(() => TWO_FACTOR_AUTH_ROUTE); const mockedOnNext = jest.fn(); function setBetaEnabled(isOAuthBetaEnabled: boolean) { @@ -102,13 +91,6 @@ function setBetaEnabled(isOAuthBetaEnabled: boolean) { } as ReturnType); } -function set2FAEnabled(is2FAEnabled: boolean) { - mockedUseTwoFactorAuthRoute.mockReturnValue({ - is2FAEnabled, - getTwoFactorAuthRoute: mockedGetTwoFactorAuthRoute, - }); -} - function renderForm() { render( { beforeEach(() => { jest.clearAllMocks(); mockFormProps.current = undefined; - mockedGetTwoFactorAuthRoute.mockReturnValue(TWO_FACTOR_AUTH_ROUTE); mockedShouldUseUpdateNetSuiteTokens.mockReturnValue(false); }); - describe.each([true, false])('when the netSuiteOAuth beta is enabled and 2FA enabled is %s', (is2FAEnabled) => { + describe('when the netSuiteOAuth beta is enabled', () => { beforeEach(() => { setBetaEnabled(true); - set2FAEnabled(is2FAEnabled); }); it('hands off to the OAuth setup with the policy, account ID and environment URL', () => { @@ -161,13 +141,6 @@ describe('NetSuiteTokenInputForm', () => { expect(mockedOnNext).not.toHaveBeenCalled(); }); - it('does not show the 2FA requirement modal', () => { - renderForm(); - submitForm(); - - expect(screen.queryByTestId('require-2fa-modal')).toBeNull(); - }); - it('submits synchronously so the setup link opens inside the tap gesture and is not popup-blocked', () => { renderForm(); @@ -187,16 +160,14 @@ describe('NetSuiteTokenInputForm', () => { describe('when the netSuiteOAuth beta is disabled', () => { beforeEach(() => { setBetaEnabled(false); - set2FAEnabled(false); }); - it('writes the token-based credentials without requiring 2FA', () => { + it('writes the token-based credentials', () => { renderForm(); submitForm(); expect(mockedConnectPolicyToNetSuite).toHaveBeenCalledWith(POLICY_ID, FORM_VALUES); expect(mockedConnectToNetSuiteOAuthSetup).not.toHaveBeenCalled(); - expect(screen.queryByTestId('require-2fa-modal')).toBeNull(); }); it('advances the wizard so the RHP is dismissed', () => {