Skip to content

Commit

Permalink
increase number of tokens to 10k
Browse files Browse the repository at this point in the history
  • Loading branch information
moodysalem committed Sep 29, 2020
1 parent dca463d commit d65f872
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/tokenlist.schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@
"$ref": "#/definitions/TokenInfo"
},
"minItems": 1,
"maxItems": 1000
"maxItems": 10000
},
"keywords": {
"type": "array",
Expand Down
16 changes: 16 additions & 0 deletions test/__snapshots__/tokenlist.schema.test.ts.snap
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`schema allows up to 10k tokens 1`] = `null`;

exports[`schema checks token address 1`] = `
Array [
Object {
Expand Down Expand Up @@ -76,6 +78,20 @@ Array [
]
`;

exports[`schema fails with 10001 tokens 1`] = `
Array [
Object {
"dataPath": ".tokens",
"keyword": "maxItems",
"message": "should NOT have more than 10000 items",
"params": Object {
"limit": 10000,
},
"schemaPath": "#/properties/tokens/maxItems",
},
]
`;

exports[`schema fails with big names 1`] = `
Array [
Object {
Expand Down
16 changes: 16 additions & 0 deletions test/tokenlist.schema.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,20 @@ describe('schema', () => {
checkSchema(invalidVersion2, false);
checkSchema(invalidVersion3, false);
});

it('allows up to 10k tokens', () => {
const exampleListWith10kTokens = {
...exampleList,
tokens: [...Array(10000)].map(() => exampleList.tokens[0]),
};
checkSchema(exampleListWith10kTokens, true);
});

it('fails with 10001 tokens', () => {
const exampleListWith10kTokensPlusOne = {
...exampleList,
tokens: [...Array(10001)].map(() => exampleList.tokens[0]),
};
checkSchema(exampleListWith10kTokensPlusOne, false);
});
});

0 comments on commit d65f872

Please sign in to comment.