1
0
mirror of https://github.com/trezor/trezor-wallet synced 2024-12-28 18:08:08 +00:00

100% coverage in eth utils

This commit is contained in:
Vladimir Volek 2018-09-12 14:55:12 +02:00
parent 1a6c90bec0
commit 7b22a965b6
2 changed files with 9 additions and 3 deletions

View File

@ -22,6 +22,8 @@ exports[`eth utils hexToDecimal 4`] = `"1"`;
exports[`eth utils hexToDecimal 5`] = `"0"`;
exports[`eth utils hexToDecimal 6`] = `"null"`;
exports[`eth utils padLeftEven 1`] = `"02540be3ff"`;
exports[`eth utils sanitizeHex 1`] = `"0x02540be3ff"`;
@ -34,6 +36,10 @@ exports[`eth utils sanitizeHex 4`] = `"0x0100"`;
exports[`eth utils sanitizeHex 5`] = `null`;
exports[`eth utils sanitizeHex 6`] = `""`;
exports[`eth utils strip 1`] = `""`;
exports[`eth utils strip 2`] = `"02540be3ff"`;
exports[`eth utils strip 3`] = `"02540be3ff"`;

View File

@ -11,7 +11,7 @@ describe('eth utils', () => {
});
it('hexToDecimal', () => {
const input = ['2540be3ff', '64', '2', '1', '0'];
const input = ['2540be3ff', '64', '2', '1', '0', ''];
input.forEach((entry) => {
expect(ethUtils.hexToDecimal(entry)).toMatchSnapshot();
@ -27,7 +27,7 @@ describe('eth utils', () => {
});
it('sanitizeHex', () => {
const input = ['0x2540be3ff', '1', '2', '100', 999];
const input = ['0x2540be3ff', '1', '2', '100', 999, ''];
input.forEach((entry) => {
expect(ethUtils.sanitizeHex(entry)).toMatchSnapshot();
@ -36,7 +36,7 @@ describe('eth utils', () => {
it('strip', () => {
const input = ['0x', '0x2540be3ff'];
const input = ['0x', '0x2540be3ff', '2540be3ff'];
input.forEach((entry) => {
expect(ethUtils.strip(entry)).toMatchSnapshot();