Skip to content

Commit

Permalink
tests: added tests for empty array errors
Browse files Browse the repository at this point in the history
  • Loading branch information
andreabadesso committed Sep 26, 2024
1 parent 0bca18f commit 9a60cc6
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/daemon/__tests__/db/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,9 @@ describe('address and wallet related tests', () => {
};
await updateAddressTablesWithTx(mysql, txId5, timestamp5, addrMap5);
await expect(checkAddressBalanceTable(mysql, 5, address1, 'token1', 5, 7, lockExpires - 1, 5)).resolves.toBe(true);

// We shouldn't throw if the addressBalanceMap is empty:
await expect(updateAddressTablesWithTx(mysql, txId5, timestamp5, {})).resolves.not.toThrow();
});

test('updateAddressLockedBalance', async () => {
Expand Down Expand Up @@ -715,6 +718,9 @@ describe('address and wallet related tests', () => {

const addressWalletMap = await getAddressWalletInfo(mysql, Object.keys(finalMap));
expect(addressWalletMap).toStrictEqual(finalMap);

// Should not throw on empty addresses list
await expect(getAddressWalletInfo(mysql, [])).resolves.not.toThrow();
});

test('updateWalletLockedBalance', async () => {
Expand Down

0 comments on commit 9a60cc6

Please sign in to comment.