Skip to content

Commit f5ca285

Browse files
MelvinBothoangzinh
andcommitted
Add test case for trackingEnabled=false with falsy taxCode
Verifies that getTaxRateTitle returns an empty string when the policy has tax tracking disabled and the transaction has no taxCode set. Co-authored-by: Vinh Hoang <hoangzinh@users.noreply.github.com>
1 parent ac2fafa commit f5ca285

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

tests/unit/TransactionUtilsTest.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,6 +1893,22 @@ describe('TransactionUtils', () => {
18931893
expect(result).toBe('Tax exempt (0%) • Default');
18941894
});
18951895

1896+
it('should return empty string when trackingEnabled is false and transaction has no taxCode', () => {
1897+
const policyWithTrackingDisabled: Policy = {
1898+
...createRandomPolicy(0),
1899+
tax: {trackingEnabled: false},
1900+
taxRates: CONST.DEFAULT_TAX,
1901+
};
1902+
const transaction = generateTransaction({
1903+
taxCode: undefined,
1904+
taxValue: undefined,
1905+
});
1906+
1907+
const result = TransactionUtils.getTaxRateTitle(policyWithTrackingDisabled, transaction, false, undefined);
1908+
1909+
expect(result).toBe('');
1910+
});
1911+
18961912
it('should return empty string when policy is undefined', () => {
18971913
const transaction = generateTransaction({
18981914
taxCode: 'id_TAX_RATE_1',

0 commit comments

Comments
 (0)