forked from pancakeswap/pancake-frontend
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: Add tests for token config (pancakeswap#709)
- Loading branch information
1 parent
515ee53
commit 5ba284a
Showing
3 changed files
with
37 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
REACT_APP_CHAIN_ID = "56" | ||
|
||
REACT_APP_NODE_1 = "https://bsc-dataseed1.ninicoin.io" | ||
REACT_APP_NODE_2 = "https://bsc-dataseed1.defibit.io" | ||
REACT_APP_NODE_3 = "https://bsc-dataseed.binance.org" |
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 |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import map from 'lodash/map' | ||
import omitBy from 'lodash/omitBy' | ||
import erc20ABI from 'config/abi/erc20.json' | ||
import tokens from 'config/constants/tokens' | ||
import { Token } from 'config/constants/types' | ||
import multicall from 'utils/multicall' | ||
|
||
// remove BNB because it's not a Bep20 token | ||
const tokensToTest = omitBy(tokens, (token) => token.symbol.toLowerCase() === 'bnb') | ||
|
||
describe('Config tokens', () => { | ||
it.each(map(tokensToTest, (token, key) => [key, token]))('Token %s', async (key, token: Token) => { | ||
const [[symbol], [decimals]] = await multicall(erc20ABI, [ | ||
{ | ||
address: token.address[56], | ||
name: 'symbol', | ||
}, | ||
{ | ||
address: token.address[56], | ||
name: 'decimals', | ||
}, | ||
]) | ||
|
||
expect(key).toBe(token.symbol.toLowerCase()) | ||
expect(token.symbol.toLowerCase()).toBe(symbol.toLowerCase()) | ||
expect(token.decimals).toBe(parseInt(decimals, 10)) | ||
}) | ||
}) |
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