Skip to content

Commit 36597a5

Browse files
MelvinBotinimaga
andcommitted
Fix: add showInReview to mock type annotation in useTransactionViolationsTest
The mock's mergeProhibitedViolations parameter type was missing the showInReview property, causing a TS2345 error when .some() tried to access it on the typed array elements. Co-authored-by: Issa Nimaga <inimaga@users.noreply.github.com>
1 parent 222b7aa commit 36597a5

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

tests/unit/useTransactionViolationsTest.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jest.mock('@libs/TransactionUtils', () => {
1414
return {
1515
isViolationDismissed: jest.fn(),
1616
shouldShowViolation: jest.fn(),
17-
mergeProhibitedViolations: (transactionViolations: Array<{name: string; type: string; data?: {prohibitedExpenseRule?: string | string[]}}>) => {
17+
mergeProhibitedViolations: (transactionViolations: Array<{name: string; type: string; showInReview?: boolean; data?: {prohibitedExpenseRule?: string | string[]}}>) => {
1818
const prohibitedViolations = transactionViolations.filter((violation) => violation.name === CONST_MOCK.VIOLATIONS.PROHIBITED_EXPENSE);
1919

2020
if (prohibitedViolations.length === 0) {
@@ -35,7 +35,7 @@ jest.mock('@libs/TransactionUtils', () => {
3535
prohibitedExpenseRule: prohibitedExpenses,
3636
},
3737
type: CONST_MOCK.VIOLATION_TYPES.VIOLATION,
38-
showInReview: prohibitedViolations.some((v: {showInReview?: boolean}) => v.showInReview),
38+
showInReview: prohibitedViolations.some((v) => v.showInReview),
3939
};
4040

4141
return [...transactionViolations.filter((violation) => violation.name !== CONST_MOCK.VIOLATIONS.PROHIBITED_EXPENSE), mergedProhibitedViolations];

0 commit comments

Comments
 (0)