Skip to content

Commit 51b1291

Browse files
chore: ensure translations are loaded before running unit tests
1 parent 7d3fcb1 commit 51b1291

14 files changed

Lines changed: 20 additions & 1 deletion

tests/actions/IOUTest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ describe('actions/IOU', () => {
155155
},
156156
});
157157
IntlStore.load(CONST.LOCALES.EN);
158+
return waitForBatchedUpdates();
158159
});
159160

160161
let mockFetch: MockFetch;

tests/unit/CardFeedUtilsTest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {translateLocal} from '@libs/Localize';
33
import CONST from '@src/CONST';
44
import IntlStore from '@src/languages/IntlStore';
55
import type {WorkspaceCardsList} from '@src/types/onyx';
6+
import waitForBatchedUpdates from '../utils/waitForBatchedUpdates';
67

78
/* eslint-disable @typescript-eslint/naming-convention */
89
const fakeWorkspace: Record<string, WorkspaceCardsList> = {
@@ -61,6 +62,7 @@ const fakeWorkspace: Record<string, WorkspaceCardsList> = {
6162
describe('Card Feed Utils', () => {
6263
beforeAll(() => {
6364
IntlStore.load(CONST.LOCALES.EN);
65+
return waitForBatchedUpdates();
6466
});
6567
it('returns display name of workspace & domain cards', () => {
6668
const cardFeedNamesWithType = getCardFeedNamesWithType({workspaceCardFeeds: fakeWorkspace, translate: translateLocal});

tests/unit/CardUtilsTest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ import {
2828
} from '@src/libs/CardUtils';
2929
import type {CardFeeds, CardList, CompanyCardFeed, ExpensifyCardSettings, PersonalDetailsList, Policy, WorkspaceCardsList} from '@src/types/onyx';
3030
import type {CompanyCardFeedWithNumber} from '@src/types/onyx/CardFeeds';
31+
import waitForBatchedUpdates from '../utils/waitForBatchedUpdates';
3132

3233
const shortDate = '0924';
3334
const shortDateSlashed = '09/24';
@@ -443,6 +444,7 @@ describe('CardUtils', () => {
443444
describe('getCustomOrFormattedFeedName', () => {
444445
beforeAll(() => {
445446
IntlStore.load(CONST.LOCALES.EN);
447+
return waitForBatchedUpdates();
446448
});
447449
it('Should return custom name if exists', () => {
448450
const feed = CONST.COMPANY_CARD.FEED_BANK_NAME.VISA;

tests/unit/CategoryOptionListUtilsTest.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ import CONST from '@src/CONST';
55
import IntlStore from '@src/languages/IntlStore';
66
import type {PolicyCategories} from '@src/types/onyx';
77
import type {PendingAction} from '@src/types/onyx/OnyxCommon';
8+
import waitForBatchedUpdates from '../utils/waitForBatchedUpdates';
89

910
describe('CategoryOptionListUtils', () => {
1011
beforeAll(() => {
1112
IntlStore.load(CONST.LOCALES.DEFAULT);
13+
return waitForBatchedUpdates();
1214
});
1315
it('getCategoryListSections()', () => {
1416
const search = 'Food';

tests/unit/CurrencyUtilsTest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ describe('CurrencyUtils', () => {
3232

3333
beforeEach(() => {
3434
IntlStore.load(CONST.LOCALES.DEFAULT);
35+
return waitForBatchedUpdates();
3536
});
3637

3738
afterEach(() => Onyx.clear());

tests/unit/ModifiedExpenseMessageTest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import waitForBatchedUpdates from '../utils/waitForBatchedUpdates';
1111
describe('ModifiedExpenseMessage', () => {
1212
beforeAll(() => {
1313
IntlStore.load(CONST.LOCALES.EN);
14+
return waitForBatchedUpdates();
1415
});
1516
describe('getForAction', () => {
1617
const report = createRandomReport(1);

tests/unit/OptionsListUtilsTest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ type PersonalDetailsList = Record<string, PersonalDetails & OptionData>;
4646
describe('OptionsListUtils', () => {
4747
beforeAll(() => {
4848
IntlStore.load(CONST.LOCALES.EN);
49+
return waitForBatchedUpdates();
4950
});
5051
const policyID = 'ABC123';
5152

tests/unit/ReportActionsUtilsTest.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,8 @@ describe('ReportActionsUtils', () => {
2727
wrapOnyxWithWaitForBatchedUpdates(Onyx);
2828
IntlStore.load(CONST.LOCALES.DEFAULT);
2929
// Initialize the network key for OfflineWithFeedback
30-
return Onyx.merge(ONYXKEYS.NETWORK, {isOffline: false});
30+
Onyx.merge(ONYXKEYS.NETWORK, {isOffline: false});
31+
return waitForBatchedUpdates();
3132
});
3233

3334
// Clear out Onyx after each test so that each test starts with a clean slate

tests/unit/SidebarOrderTest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ describe('Sidebar', () => {
3737
});
3838
initOnyxDerivedValues();
3939
IntlStore.load(CONST.LOCALES.EN);
40+
return waitForBatchedUpdates();
4041
});
4142

4243
beforeEach(() => {

tests/unit/SidebarUtilsTest.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ describe('SidebarUtils', () => {
2929
});
3030
IntlStore.load(CONST.LOCALES.EN);
3131
initOnyxDerivedValues();
32+
return waitForBatchedUpdates();
3233
});
3334

3435
afterAll(async () => {

0 commit comments

Comments
 (0)