Skip to content

Commit

Permalink
fix: unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
truph01 committed Nov 5, 2024
1 parent a708691 commit 85d684f
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion tests/unit/WorkspaceSettingsUtilsTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Onyx from 'react-native-onyx';
import {getBrickRoadForPolicy} from '@libs/WorkspacesSettingsUtils';
import ONYXKEYS from '@src/ONYXKEYS';
import {Report, ReportActions} from '@src/types/onyx';

Check failure on line 5 in tests/unit/WorkspaceSettingsUtilsTest.ts

View workflow job for this annotation

GitHub Actions / ESLint check

All imports in the declaration are only used as types. Use `import type`

Check failure on line 5 in tests/unit/WorkspaceSettingsUtilsTest.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

All imports in the declaration are only used as types. Use `import type`
import {ReportCollectionDataSet} from '@src/types/onyx/Report';

Check failure on line 6 in tests/unit/WorkspaceSettingsUtilsTest.ts

View workflow job for this annotation

GitHub Actions / ESLint check

All imports in the declaration are only used as types. Use `import type`

Check failure on line 6 in tests/unit/WorkspaceSettingsUtilsTest.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

All imports in the declaration are only used as types. Use `import type`
import * as TestHelper from '../utils/TestHelper';
import waitForBatchedUpdates from '../utils/waitForBatchedUpdates';

Expand Down Expand Up @@ -49,6 +50,21 @@ describe('WorkspacesSettingsUtils', () => {
avatarFileName: '',
};

const MOCK_REPORTS: ReportCollectionDataSet = {
[`${ONYXKEYS.COLLECTION.REPORT}4286515777714555` as const]: report,
[`${ONYXKEYS.COLLECTION.REPORT}6955627196303088` as const]: {
reportID: '6955627196303088',
chatReportID: '1699789757771388',
policyID: '57D0F454E0BCE54B',
type: 'expense',
ownerAccountID: 18634488,
stateNum: 1,
statusNum: 1,
parentReportID: '1699789757771388',
parentReportActionID: '7978085421707288417',
},
};

const actions: OnyxCollection<ReportActions> = {
reportActions_1699789757771388: {

Check failure on line 69 in tests/unit/WorkspaceSettingsUtilsTest.ts

View workflow job for this annotation

GitHub Actions / ESLint check

Object Literal Property name `reportActions_1699789757771388` must match one of the following formats: camelCase, UPPER_CASE, PascalCase

Check failure on line 69 in tests/unit/WorkspaceSettingsUtilsTest.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Object Literal Property name `reportActions_1699789757771388` must match one of the following formats: camelCase, UPPER_CASE, PascalCase
'4007735288062946397': {

Check failure on line 70 in tests/unit/WorkspaceSettingsUtilsTest.ts

View workflow job for this annotation

GitHub Actions / ESLint check

Object Literal Property name `4007735288062946397` must match one of the following formats: camelCase, UPPER_CASE, PascalCase

Check failure on line 70 in tests/unit/WorkspaceSettingsUtilsTest.ts

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Object Literal Property name `4007735288062946397` must match one of the following formats: camelCase, UPPER_CASE, PascalCase
Expand Down Expand Up @@ -540,8 +556,11 @@ describe('WorkspacesSettingsUtils', () => {
};

await Onyx.multiSet({
...report,
...MOCK_REPORTS,
...actions,
[ONYXKEYS.SESSION]: {
accountID: 18634488,
},
transactionViolations_3106135972713435169: [
{
name: 'missingCategory',
Expand All @@ -556,6 +575,8 @@ describe('WorkspacesSettingsUtils', () => {
],
});

await waitForBatchedUpdates();

const result = getBrickRoadForPolicy(report, actions);
expect(result).toBe('error');
});
Expand Down

0 comments on commit 85d684f

Please sign in to comment.