Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis committed Jan 10, 2024
1 parent 683e602 commit 4b0f012
Showing 1 changed file with 4 additions and 9 deletions.
13 changes: 4 additions & 9 deletions packages/loot-core/src/shared/transactions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ describe('Transactions', () => {
expect(diff).toEqual({
added: [],
deleted: [],
updated: [{ id: 't1', amount: 5000 }],
updated: [expect.objectContaining({ id: 't1', amount: 5000 })],
});
expect(data.map(t => ({ id: t.id, amount: t.amount })).sort()).toEqual([
{ id: expect.any(String), amount: 5000 },
Expand All @@ -71,17 +71,12 @@ describe('Transactions', () => {
});

test('updating does nothing if value not changed', () => {
const updatedTransaction = makeTransaction({ id: 't1', amount: 5000 });
const transactions = [
makeTransaction({ id: 't1', amount: 5000 }),
updatedTransaction,
makeTransaction({ amount: 3000 }),
];
const { data, diff } = updateTransaction(
transactions,
makeTransaction({
id: 't1',
amount: 5000,
}),
);
const { data, diff } = updateTransaction(transactions, updatedTransaction);
expect(diff).toEqual({ added: [], deleted: [], updated: [] });
expect(data.map(t => ({ id: t.id, amount: t.amount })).sort()).toEqual([
{ id: expect.any(String), amount: 5000 },
Expand Down

0 comments on commit 4b0f012

Please sign in to comment.