Skip to content

Commit 3fe20d8

Browse files
authored
test: add validation for token decimals (#1950)
Add a new test case to validate that all tokens in the list have proper decimal values. This ensures that: - decimals are numbers - decimals are non-negative - decimals do not exceed 18 (standard ERC20 maximum) This validation helps prevent issues with token display and calculations in the Uniswap interface.
1 parent 1a4cecb commit 3fe20d8

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

test/uniswap-default.test.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,4 +68,12 @@ describe('buildList', () => {
6868
expect(packageJson.version).to.match(/^\d+\.\d+\.\d+$/);
6969
expect(packageJson.version).to.equal(`${defaultTokenList.version.major}.${defaultTokenList.version.minor}.${defaultTokenList.version.patch}`);
7070
});
71-
});
71+
72+
it('all tokens have valid decimals', () => {
73+
for (let token of defaultTokenList.tokens) {
74+
expect(token.decimals).to.be.a('number');
75+
expect(token.decimals).to.be.gte(0);
76+
expect(token.decimals).to.be.lte(18);
77+
}
78+
});
79+
});

0 commit comments

Comments
 (0)