Skip to content

Commit 5b44ede

Browse files
authored
Merge pull request #283 from alephium/reject-token-with-extra-fields
Reject token with extra fields
2 parents decac5c + 56bcae6 commit 5b44ede

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

test/token-list/token-list.test.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ describe('TokenList', function () {
8080
expect(testnetJson.networkId).toEqual(1)
8181
})
8282

83+
it('should not contain extra fields', () => {
84+
const allowedFields = ['id', 'name', 'nameOnChain', 'symbol', 'symbolOnChain', 'decimals', 'description', 'logoURI']
85+
tokenLists.forEach((tokenList) => {
86+
tokenList.tokens.forEach((token) => {
87+
const tokenFields = Object.keys(token)
88+
tokenFields.forEach((field) => expect(allowedFields).toContain(field))
89+
})
90+
})
91+
})
92+
8393
const mainnetNodeProvider = new NodeProvider(mainnetURL)
8494
mainnetTokenList.tokens.forEach((token) => {
8595
if (token.symbol !== 'ALPH') {

0 commit comments

Comments
 (0)