Skip to content

Commit

Permalink
✅ Fix test coverage of transaction api utils
Browse files Browse the repository at this point in the history
  • Loading branch information
slaweet committed Apr 26, 2019
1 parent 02a888a commit e9bb0f4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/utils/api/lsk/transactions.test.js
Expand Up @@ -91,5 +91,9 @@ describe('Utils: Transactions API', () => {
await getSingleTransaction({ apiClient, id });
expect(apiClient.node.getTransactions).toHaveBeenCalledWith('unconfirmed', { id });
});

it('should reject if apiClient is undefined', async () => {
expect(getSingleTransaction({ id })).rejects.toThrow('');
});
});
});
15 changes: 15 additions & 0 deletions src/utils/api/transactions.test.js
Expand Up @@ -54,6 +54,21 @@ describe('Utils: Transactions API', () => {
});
});

describe('getSingleTransaction', () => {
it('should resolve getSingleTransaction for specific token (BTC, LSK, ...) based on the address format ', () => {
const params = {
id,
apiClient: liskAPIClient,
};
liskAPIClient.transactions.get.mockResolvedValue({ data: [] });
const promise = getSingleTransaction(params);
expect(typeof promise.then).toEqual('function');
expect(liskAPIClient.transactions.get).toHaveBeenCalledWith(expect.objectContaining({
id,
}));
});
});

describe('unconfirmedTransactions', () => {
it('should return a promise', () => {
const promise = unconfirmedTransactions(liskAPIClient);
Expand Down

0 comments on commit e9bb0f4

Please sign in to comment.