Skip to content

Commit

Permalink
chore: add unit test for stored Erc20Deposit
Browse files Browse the repository at this point in the history
  • Loading branch information
dandheedge committed Oct 9, 2023
1 parent 9bb2c7f commit a0aa280
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions tests/handlers/InputAdded.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -123,5 +123,34 @@ describe('InputAdded', () => {
expect(mockApplicationStorage.size).toBe(1);
expect(mockInputStorage.size).toBe(1);
});
test('Erc20Deposit Stored', async () => {
const name = 'SimpleERC20';
const symbol = 'SIM20';
const decimals = 18;
const token = new Token({
id: tokenAddress,
name,
symbol,
decimals,
});
erc20.name.mockResolvedValueOnce('SimpleERC20');
erc20.symbol.mockResolvedValue('SIM20');
erc20.decimals.mockResolvedValue(18);
const deposit = new Erc20Deposit({
id: input.id,
amount,
from,
token,
});
vi.spyOn(inputAdded, 'handlePayload').mockImplementation(
(input, block, ctx) => {
return new Promise((resolve) => {
resolve(deposit);
});
},
);
await inputAdded.handle(logs[0], block, ctx);
expect(mockDepositStorage.size).toBe(1);
});
});
});

0 comments on commit a0aa280

Please sign in to comment.