Skip to content

Commit

Permalink
test: add basic "unit" test
Browse files Browse the repository at this point in the history
Adds two tests for getWalletData function
  • Loading branch information
martinkyselak committed Jan 2, 2024
1 parent db8cfca commit d8d4052
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/api/getWallet.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Status } from '@tatumio/tatum';
import { getWalletData } from './getWallet';

// TODO: mock Tatum library to get real unit tests

test('should return error for non-existing address', async () => {
const result = await getWalletData('non-existing-address');
expect(result).toStrictEqual([Status.ERROR, null, null]);
});

test('should return valid response for existing address', async () => {
const result = await getWalletData('0xb794f5ea0ba39494ce839613fffba74279579268');
expect(result[0]).toBe(Status.SUCCESS);

expect(result[1]).toBeDefined();
expect(result[1][0].balance.length).toBeGreaterThan(0);

expect(result[2]).toBeDefined();
expect(result[2].length).toBe(10);
});

0 comments on commit d8d4052

Please sign in to comment.