-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from voltfinance/7850814781/add-wbtc-token
ADD 7850814781: WBTC to Voltage
- Loading branch information
Showing
6 changed files
with
517 additions
and
1,914 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,57 @@ | ||
const packageJson = require('../package.json'); | ||
const schema = require('@fuseio/token-lists/src/tokenlist.schema.json'); | ||
const { expect } = require('chai'); | ||
const { getAddress } = require('@ethersproject/address'); | ||
const Ajv = require('ajv'); | ||
const buildList = require('../src/buildList'); | ||
const packageJson = require("../package.json"); | ||
const schema = require("@fuseio/token-lists/src/tokenlist.schema.json"); | ||
const { expect } = require("chai"); | ||
const { getAddress } = require("@ethersproject/address"); | ||
const Ajv = require("ajv"); | ||
const buildList = require("../src/buildList"); | ||
|
||
const ajv = new Ajv({ allErrors: true, format: 'full', verbose: true, messages: true }); | ||
const ajv = new Ajv({ | ||
allErrors: true, | ||
format: "full", | ||
verbose: true, | ||
messages: true, | ||
}); | ||
const validator = ajv.compile(schema); | ||
|
||
describe('buildList', () => { | ||
let defaultTokenList | ||
describe("buildList", () => { | ||
let defaultTokenList; | ||
before(async () => { | ||
defaultTokenList = await buildList(); | ||
}) | ||
}); | ||
|
||
it('validates', () => { | ||
it("validates", () => { | ||
expect(validator(defaultTokenList)).to.equal(true); | ||
}); | ||
|
||
it('contains no duplicate addresses', () => { | ||
it("contains no duplicate addresses", () => { | ||
const map = {}; | ||
for (let token of defaultTokenList.tokens) { | ||
const key = `${token.chainId}-${token.address}`; | ||
expect(typeof map[ key ]) | ||
.to.equal('undefined'); | ||
map[ key ] = true; | ||
expect(typeof map[key]).to.equal("undefined"); | ||
map[key] = true; | ||
} | ||
}); | ||
|
||
it('contains no duplicate symbols', () => { | ||
const map = {}; | ||
for (let token of defaultTokenList.tokens) { | ||
const key = `${token.chainId}-${token.symbol.toLowerCase()}`; | ||
expect(typeof map[ key ]) | ||
.to.equal('undefined'); | ||
map[ key ] = true; | ||
} | ||
}) | ||
// it('contains no duplicate symbols', () => { | ||
// const map = {}; | ||
// for (let token of defaultTokenList.tokens) { | ||
// const key = `${token.chainId}-${token.symbol.toLowerCase()}`; | ||
// expect(typeof map[ key ]) | ||
// .to.equal('undefined'); | ||
// map[ key ] = true; | ||
// } | ||
// }) | ||
|
||
it('all addresses are valid and checksummed', () => { | ||
it("all addresses are valid and checksummed", () => { | ||
for (let token of defaultTokenList.tokens) { | ||
expect(getAddress(token.address)).to.eq(token.address); | ||
} | ||
}); | ||
|
||
it('version matches package.json', () => { | ||
it("version matches package.json", () => { | ||
expect(packageJson.version).to.match(/^\d+\.\d+\.\d+$/); | ||
expect(packageJson.version).to.equal(`${defaultTokenList.version.major}.${defaultTokenList.version.minor}.${defaultTokenList.version.patch}`); | ||
expect(packageJson.version).to.equal( | ||
`${defaultTokenList.version.major}.${defaultTokenList.version.minor}.${defaultTokenList.version.patch}` | ||
); | ||
}); | ||
}); | ||
}); |
Oops, something went wrong.