Skip to content

Commit

Permalink
Add tests for unexpected behaviour
Browse files Browse the repository at this point in the history
  • Loading branch information
jfdoming committed Oct 19, 2024
1 parent 395221c commit 6c50125
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions packages/loot-core/src/server/accounts/rules.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,32 @@ describe('Rule', () => {
},
);
});

test('generate errors on fixed amounts less than total', () => {
expect(
fixedAmountRule.exec({ imported_payee: 'James', amount: 100 }),
).toMatchObject({
error: {
difference: -100,
type: 'SplitTransactionError',
version: 1,
},
subtransactions: [{ amount: 100 }, { amount: 100 }],
});
});

test('generate errors on fixed amounts more than total', () => {
expect(
fixedAmountRule.exec({ imported_payee: 'James', amount: 300 }),
).toMatchObject({
error: {
difference: 100,
type: 'SplitTransactionError',
version: 1,
},
subtransactions: [{ amount: 100 }, { amount: 100 }],
});
});
});

test('rules are deterministically ranked', () => {
Expand Down

0 comments on commit 6c50125

Please sign in to comment.