Skip to content

Commit a36489e

Browse files
committed
fix warnings
1 parent c27d62d commit a36489e

1 file changed

Lines changed: 3 additions & 7 deletions

File tree

tests/actions/connections/Xero.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import Onyx from 'react-native-onyx';
22
import {updateXeroTravelInvoicingPayableAccount} from '@libs/actions/connections/Xero';
3-
// eslint-disable-next-line no-restricted-syntax -- this is required to allow mocking
43
import * as API from '@libs/API';
54
import type {WriteCommand} from '@libs/API/types';
65
import {WRITE_COMMANDS} from '@libs/API/types';
@@ -11,7 +10,6 @@ import waitForBatchedUpdates from '../../utils/waitForBatchedUpdates';
1110

1211
jest.mock('@libs/API');
1312
jest.mock('@expensify/react-native-hybrid-app', () => ({
14-
// eslint-disable-next-line @typescript-eslint/naming-convention
1513
__esModule: true,
1614
default: {
1715
isHybridApp: jest.fn(),
@@ -51,12 +49,11 @@ describe('actions/connections/Xero', () => {
5149
expect(command).toBe(WRITE_COMMANDS.UPDATE_MANY_POLICY_CONNECTION_CONFIGS);
5250

5351
const call = writeSpy.mock.calls.at(0);
54-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- API.write's params argument is typed as a broad union, so narrow to the shape this command sends
5552
const params = call?.[1] as {connectionName: string; configUpdate: string; idempotencyKey: string; policyID: string};
5653
expect(params.policyID).toBe(MOCK_POLICY_ID);
5754
expect(params.connectionName).toBe(CONST.POLICY.CONNECTIONS.NAME.XERO);
5855
expect(params.idempotencyKey).toBe(CONST.XERO_CONFIG.TRAVEL_INVOICING_PAYABLE_ACCOUNT);
59-
expect(JSON.parse(params.configUpdate)).toEqual({[CONST.XERO_CONFIG.TRAVEL_INVOICING_PAYABLE_ACCOUNT]: 'account-123'});
56+
expect(JSON.parse(params.configUpdate)).toEqual({[CONST.XERO_CONFIG.EXPORT]: {[CONST.XERO_CONFIG.TRAVEL_INVOICING_PAYABLE_ACCOUNT]: 'account-123'}});
6057
});
6158

6259
it('merges travelInvoicingPayableAccountID optimistically onto the Xero config', () => {
@@ -66,9 +63,8 @@ describe('actions/connections/Xero', () => {
6663
const optimisticUpdate = onyxData?.optimisticData?.at(0);
6764
expect(optimisticUpdate?.key).toBe(`${ONYXKEYS.COLLECTION.POLICY}${MOCK_POLICY_ID}`);
6865

69-
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion -- optimisticData values are typed as unknown; narrow to the partial Policy shape this update writes
70-
const value = optimisticUpdate?.value as {connections: {xero: {config: Record<string, unknown>}}};
71-
expect(value.connections.xero.config[CONST.XERO_CONFIG.TRAVEL_INVOICING_PAYABLE_ACCOUNT]).toBe('account-123');
66+
const value = optimisticUpdate?.value as {connections: {xero: {config: {export: Record<string, unknown>; pendingFields: Record<string, unknown>}}}};
67+
expect(value.connections.xero.config.export[CONST.XERO_CONFIG.TRAVEL_INVOICING_PAYABLE_ACCOUNT]).toBe('account-123');
7268
expect(value.connections.xero.config.pendingFields).toEqual({[CONST.XERO_CONFIG.TRAVEL_INVOICING_PAYABLE_ACCOUNT]: CONST.RED_BRICK_ROAD_PENDING_ACTION.UPDATE});
7369
});
7470
});

0 commit comments

Comments
 (0)