Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions tests/actions/IOUTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,6 @@ import {subscribeToUserEvents} from '@libs/actions/User';
import type {ApiCommand} from '@libs/API/types';
import {WRITE_COMMANDS} from '@libs/API/types';
import {getMicroSecondOnyxErrorWithTranslationKey} from '@libs/ErrorUtils';
// eslint-disable-next-line @typescript-eslint/no-deprecated
import {translateLocal} from '@libs/Localize';
import Navigation from '@libs/Navigation/Navigation';
import {rand64} from '@libs/NumberUtils';
import {getLoginsByAccountIDs} from '@libs/PersonalDetailsUtils';
Expand Down Expand Up @@ -107,7 +105,7 @@ import createRandomTransaction from '../utils/collections/transaction';
import getOnyxValue from '../utils/getOnyxValue';
import PusherHelper from '../utils/PusherHelper';
import type {MockFetch} from '../utils/TestHelper';
import {getGlobalFetchMock, getOnyxData, setPersonalDetails, signInWithTestUser} from '../utils/TestHelper';
import {getGlobalFetchMock, getOnyxData, setPersonalDetails, signInWithTestUser, translateLocal} from '../utils/TestHelper';
import waitForBatchedUpdates from '../utils/waitForBatchedUpdates';
import waitForBatchedUpdatesWithAct from '../utils/waitForBatchedUpdatesWithAct';
import waitForNetworkPromises from '../utils/waitForNetworkPromises';
Expand Down Expand Up @@ -1643,7 +1641,6 @@ describe('actions/IOU', () => {
Onyx.disconnect(connection);
expect(transaction?.pendingAction).toBe(CONST.RED_BRICK_ROAD_PENDING_ACTION.ADD);
expect(transaction?.errors).toBeTruthy();
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(Object.values(transaction?.errors ?? {}).at(0)).toEqual(translateLocal('iou.error.genericCreateFailureMessage'));
resolve();
},
Expand Down Expand Up @@ -1946,7 +1943,6 @@ describe('actions/IOU', () => {
const accountantEmployee = policyData?.employeeList?.[accountant.email];
expect(accountantEmployee).toBeTruthy();
expect(accountantEmployee?.errors).toBeTruthy();
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(Object.values(accountantEmployee?.errors ?? {}).at(0)).toEqual(translateLocal('workspace.people.error.genericAdd'));

// Cleanup
Expand Down Expand Up @@ -3463,7 +3459,6 @@ describe('actions/IOU', () => {
callback: (allActions) => {
Onyx.disconnect(connection);
const erroredAction = Object.values(allActions ?? {}).find((action) => !isEmptyObject(action?.errors));
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(Object.values(erroredAction?.errors ?? {}).at(0)).toEqual(translateLocal('iou.error.other'));
resolve();
},
Expand Down
23 changes: 7 additions & 16 deletions tests/actions/PolicyMemberTest.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import Onyx from 'react-native-onyx';
import type {OnyxEntry} from 'react-native-onyx';
import DateUtils from '@libs/DateUtils';
// eslint-disable-next-line @typescript-eslint/no-deprecated
import {translateLocal} from '@libs/Localize';
import CONST from '@src/CONST';
import OnyxUpdateManager from '@src/libs/actions/OnyxUpdateManager';
import * as Member from '@src/libs/actions/Policy/Member';
Expand Down Expand Up @@ -571,8 +569,7 @@ describe('actions/PolicyMember', () => {
});

// Then it should show the singular member added success message
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(importedSpreadsheet?.importFinalModal.prompt).toBe(translateLocal('spreadsheet.importMembersSuccessfulDescription', {added: 1, updated: 0}));
expect(importedSpreadsheet?.importFinalModal.prompt).toBe(TestHelper.translateLocal('spreadsheet.importMembersSuccessfulDescription', {added: 1, updated: 0}));
});

it('should show a "multiple members added message" when multiple new members are added', async () => {
Expand Down Expand Up @@ -601,8 +598,7 @@ describe('actions/PolicyMember', () => {
});

// Then it should show the plural member added success message
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(importedSpreadsheet?.importFinalModal.prompt).toBe(translateLocal('spreadsheet.importMembersSuccessfulDescription', {added: 2, updated: 0}));
expect(importedSpreadsheet?.importFinalModal.prompt).toBe(TestHelper.translateLocal('spreadsheet.importMembersSuccessfulDescription', {added: 2, updated: 0}));
});

it('should show a "no members added/updated message" when no new members are added or updated', async () => {
Expand Down Expand Up @@ -635,8 +631,7 @@ describe('actions/PolicyMember', () => {
});

// Then it should show the no member added/updated message
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(importedSpreadsheet?.importFinalModal.prompt).toBe(translateLocal('spreadsheet.importMembersSuccessfulDescription', {added: 0, updated: 0}));
expect(importedSpreadsheet?.importFinalModal.prompt).toBe(TestHelper.translateLocal('spreadsheet.importMembersSuccessfulDescription', {added: 0, updated: 0}));
});

it('should show a "single member updated message" when a member is updated', async () => {
Expand Down Expand Up @@ -669,8 +664,7 @@ describe('actions/PolicyMember', () => {
});

// Then it should show the singular member updated success message
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(importedSpreadsheet?.importFinalModal.prompt).toBe(translateLocal('spreadsheet.importMembersSuccessfulDescription', {added: 0, updated: 1}));
expect(importedSpreadsheet?.importFinalModal.prompt).toBe(TestHelper.translateLocal('spreadsheet.importMembersSuccessfulDescription', {added: 0, updated: 1}));
});

it('should show a "multiple members updated message" when multiple members are updated', async () => {
Expand Down Expand Up @@ -711,8 +705,7 @@ describe('actions/PolicyMember', () => {
});

// Then it should show the plural member updated success message
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(importedSpreadsheet?.importFinalModal.prompt).toBe(translateLocal('spreadsheet.importMembersSuccessfulDescription', {added: 0, updated: 2}));
expect(importedSpreadsheet?.importFinalModal.prompt).toBe(TestHelper.translateLocal('spreadsheet.importMembersSuccessfulDescription', {added: 0, updated: 2}));
});

it('should show a "single member added and updated message" when a member is both added and updated', async () => {
Expand Down Expand Up @@ -748,8 +741,7 @@ describe('actions/PolicyMember', () => {
});

// Then it should show the singular member added and updated success message
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(importedSpreadsheet?.importFinalModal.prompt).toBe(translateLocal('spreadsheet.importMembersSuccessfulDescription', {added: 1, updated: 1}));
expect(importedSpreadsheet?.importFinalModal.prompt).toBe(TestHelper.translateLocal('spreadsheet.importMembersSuccessfulDescription', {added: 1, updated: 1}));
});

it('should show a "multiple members added and updated message" when multiple members are both added and updated', async () => {
Expand Down Expand Up @@ -792,8 +784,7 @@ describe('actions/PolicyMember', () => {
});

// Then it should show the plural member added and updated success message
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(importedSpreadsheet?.importFinalModal.prompt).toBe(translateLocal('spreadsheet.importMembersSuccessfulDescription', {added: 2, updated: 2}));
expect(importedSpreadsheet?.importFinalModal.prompt).toBe(TestHelper.translateLocal('spreadsheet.importMembersSuccessfulDescription', {added: 2, updated: 2}));
});
});
});
26 changes: 8 additions & 18 deletions tests/actions/PolicyTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import {Str} from 'expensify-common';
import type {OnyxCollection, OnyxEntry} from 'react-native-onyx';
import Onyx from 'react-native-onyx';
import {getOnboardingMessages} from '@libs/actions/Welcome/OnboardingFlow';
// eslint-disable-next-line @typescript-eslint/no-deprecated
import {translateLocal} from '@libs/Localize';
// eslint-disable-next-line no-restricted-syntax
import * as PersonalDetailsUtils from '@libs/PersonalDetailsUtils';
// eslint-disable-next-line no-restricted-syntax
Expand Down Expand Up @@ -1080,8 +1078,7 @@ describe('actions/Policy', () => {
});

const workspaceName = Policy.generateDefaultWorkspaceName(TEST_NON_PUBLIC_DOMAIN_EMAIL);
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(workspaceName).toBe(translateLocal('workspace.new.workspaceName', {userName: displayNameForWorkspace}));
expect(workspaceName).toBe(TestHelper.translateLocal('workspace.new.workspaceName', {userName: displayNameForWorkspace}));
});

it('should generate a workspace name based on the display name when the domain is public and display name is available', () => {
Expand All @@ -1094,8 +1091,7 @@ describe('actions/Policy', () => {
});

const workspaceName = Policy.generateDefaultWorkspaceName(TEST_EMAIL);
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(workspaceName).toBe(translateLocal('workspace.new.workspaceName', {userName: displayNameForWorkspace}));
expect(workspaceName).toBe(TestHelper.translateLocal('workspace.new.workspaceName', {userName: displayNameForWorkspace}));
});

it('should generate a workspace name based on the username when the domain is public and display name is not available', () => {
Expand All @@ -1110,8 +1106,7 @@ describe('actions/Policy', () => {
});

const workspaceName = Policy.generateDefaultWorkspaceName(TEST_EMAIL_2);
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(workspaceName).toBe(translateLocal('workspace.new.workspaceName', {userName: displayNameForWorkspace}));
expect(workspaceName).toBe(TestHelper.translateLocal('workspace.new.workspaceName', {userName: displayNameForWorkspace}));
});

it('should generate a workspace name with an incremented number when there are existing policies with similar names', async () => {
Expand All @@ -1129,8 +1124,7 @@ describe('actions/Policy', () => {
await Onyx.set(ONYXKEYS.COLLECTION.POLICY, existingPolicies);

const workspaceName = Policy.generateDefaultWorkspaceName(TEST_EMAIL);
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(workspaceName).toBe(translateLocal('workspace.new.workspaceName', {userName: TEST_DISPLAY_NAME, workspaceNumber: 2}));
expect(workspaceName).toBe(TestHelper.translateLocal('workspace.new.workspaceName', {userName: TEST_DISPLAY_NAME, workspaceNumber: 2}));
});

it('should return "My Group Workspace" when the domain is SMS', () => {
Expand All @@ -1141,8 +1135,7 @@ describe('actions/Policy', () => {
});

const workspaceName = Policy.generateDefaultWorkspaceName(TEST_SMS_DOMAIN_EMAIL);
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(workspaceName).toBe(translateLocal('workspace.new.myGroupWorkspace', {}));
expect(workspaceName).toBe(TestHelper.translateLocal('workspace.new.myGroupWorkspace', {}));
});

it('should generate a workspace name with an incremented number even if previous workspaces were created in english lang', async () => {
Expand All @@ -1164,8 +1157,7 @@ describe('actions/Policy', () => {
await Onyx.set(ONYXKEYS.COLLECTION.POLICY, existingPolicies);

const workspaceName = Policy.generateDefaultWorkspaceName(TEST_EMAIL);
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(workspaceName).toBe(translateLocal('workspace.new.workspaceName', {userName: TEST_DISPLAY_NAME, workspaceNumber: 2}));
expect(workspaceName).toBe(TestHelper.translateLocal('workspace.new.workspaceName', {userName: TEST_DISPLAY_NAME, workspaceNumber: 2}));
});
});

Expand Down Expand Up @@ -1232,8 +1224,7 @@ describe('actions/Policy', () => {

// The policy join should have the genericAdd error
expect(policyJoinData?.errors).toBeTruthy();
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(Object.values(policyJoinData?.errors ?? {}).at(0)).toEqual(translateLocal('workspace.people.error.genericAdd'));
expect(Object.values(policyJoinData?.errors ?? {}).at(0)).toEqual(TestHelper.translateLocal('workspace.people.error.genericAdd'));

mockFetch.succeed?.();
});
Expand Down Expand Up @@ -1271,8 +1262,7 @@ describe('actions/Policy', () => {

// The policy join should have the genericAdd error
expect(policyJoinData?.errors).toBeTruthy();
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(Object.values(policyJoinData?.errors ?? {}).at(0)).toEqual(translateLocal('workspace.people.error.genericAdd'));
expect(Object.values(policyJoinData?.errors ?? {}).at(0)).toEqual(TestHelper.translateLocal('workspace.people.error.genericAdd'));

mockFetch.succeed?.();
});
Expand Down
8 changes: 2 additions & 6 deletions tests/actions/ReportTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ import * as PersistedRequests from '@src/libs/actions/PersistedRequests';
import * as Report from '@src/libs/actions/Report';
import * as User from '@src/libs/actions/User';
import DateUtils from '@src/libs/DateUtils';
// eslint-disable-next-line @typescript-eslint/no-deprecated
import {translateLocal} from '@src/libs/Localize';
import Log from '@src/libs/Log';
import * as SequentialQueue from '@src/libs/Network/SequentialQueue';
import * as ReportUtils from '@src/libs/ReportUtils';
Expand Down Expand Up @@ -2253,8 +2251,7 @@ describe('actions/Report', () => {
const submitterEmployee = policyData?.employeeList?.[ownerEmail];
expect(submitterEmployee).toBeTruthy();
expect(submitterEmployee?.errors).toBeTruthy();
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(Object.values(submitterEmployee?.errors ?? {}).at(0)).toEqual(translateLocal('workspace.people.error.genericAdd'));
expect(Object.values(submitterEmployee?.errors ?? {}).at(0)).toEqual(TestHelper.translateLocal('workspace.people.error.genericAdd'));

// Cleanup
mockFetch.succeed?.();
Expand Down Expand Up @@ -2412,8 +2409,7 @@ describe('actions/Report', () => {
const submitterEmployee = policyData?.employeeList?.[ownerEmail];
expect(submitterEmployee).toBeTruthy();
expect(submitterEmployee?.errors).toBeTruthy();
// eslint-disable-next-line @typescript-eslint/no-deprecated
expect(Object.values(submitterEmployee?.errors ?? {}).at(0)).toEqual(translateLocal('workspace.people.error.genericAdd'));
expect(Object.values(submitterEmployee?.errors ?? {}).at(0)).toEqual(TestHelper.translateLocal('workspace.people.error.genericAdd'));

// Cleanup
mockFetch.succeed?.();
Expand Down
7 changes: 3 additions & 4 deletions tests/actions/TourTest.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import Onyx from 'react-native-onyx';
import OnyxUpdateManager from '@libs/actions/OnyxUpdateManager';
import {startTestDrive} from '@libs/actions/Tour';
// eslint-disable-next-line @typescript-eslint/no-deprecated
import {translateLocal} from '@libs/Localize';
import Navigation from '@libs/Navigation/Navigation';
import Parser from '@libs/Parser';
import initOnyxDerivedValues from '@userActions/OnyxDerived';
Expand Down Expand Up @@ -65,8 +63,9 @@ describe('actions/Tour', () => {
const testDriveTaskAction: ReportAction = {
...LHNTestUtils.getFakeReportAction(),
childType: CONST.REPORT.TYPE.TASK,
// eslint-disable-next-line @typescript-eslint/no-deprecated
childReportName: Parser.replace(translateLocal('onboarding.testDrive.name', {testDriveURL: `${CONST.STAGING_NEW_EXPENSIFY_URL}/${ROUTES.TEST_DRIVE_DEMO_ROOT}`})),
childReportName: Parser.replace(
TestHelper.translateLocal('onboarding.testDrive.name', {testDriveURL: `${CONST.STAGING_NEW_EXPENSIFY_URL}/${ROUTES.TEST_DRIVE_DEMO_ROOT}`}),
),
childReportID: testDriveTaskReport.reportID,
};

Expand Down
8 changes: 3 additions & 5 deletions tests/perf-test/ReportActionCompose.perf-test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ import type Navigation from '@libs/Navigation/Navigation';
import ComposeProviders from '@src/components/ComposeProviders';
import {LocaleContextProvider} from '@src/components/LocaleContextProvider';
import {KeyboardStateProvider} from '@src/components/withKeyboardState';
import * as Localize from '@src/libs/Localize';
import ONYXKEYS from '@src/ONYXKEYS';
import ReportActionCompose from '@src/pages/home/report/ReportActionCompose/ReportActionCompose';
import * as LHNTestUtils from '../utils/LHNTestUtils';
import {translateLocal} from '../utils/TestHelper';
import waitForBatchedUpdates from '../utils/waitForBatchedUpdates';

// mock PortalStateContext
Expand Down Expand Up @@ -105,8 +105,7 @@ test('[ReportActionCompose] should render Composer with text input interactions'
test('[ReportActionCompose] should press create button', async () => {
const scenario = async () => {
// Query for the create button
// eslint-disable-next-line @typescript-eslint/no-deprecated
const hintAttachmentButtonText = Localize.translateLocal('common.create');
const hintAttachmentButtonText = translateLocal('common.create');
const createButton = await screen.findByLabelText(hintAttachmentButtonText);

fireEvent.press(createButton, mockEvent);
Expand All @@ -119,8 +118,7 @@ test('[ReportActionCompose] should press create button', async () => {
test('[ReportActionCompose] should press send message button', async () => {
const scenario = async () => {
// Query for the send button
// eslint-disable-next-line @typescript-eslint/no-deprecated
const hintSendButtonText = Localize.translateLocal('common.send');
const hintSendButtonText = translateLocal('common.send');
const sendButton = await screen.findByLabelText(hintSendButtonText);

fireEvent.press(sendButton);
Expand Down
Loading
Loading