Skip to content

Commit

Permalink
Add tests to check the reward token list
Browse files Browse the repository at this point in the history
  • Loading branch information
Lbqds committed Nov 4, 2024
1 parent da65f07 commit fc15359
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion token-list/test/BridgeToken.test.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { ChainId, CHAIN_ID_ALEPHIUM, CHAIN_ID_ETH, CHAIN_ID_BSC } from '@alephium/wormhole-sdk'
import { BridgeToken, mainnetBridgeTokens } from '../src'
import { BridgeChain, getBridgeChain, validateTokenMetadata } from '../utils'
import { default as BscMainnet } from '../../configs/bsc/mainnet.json'

describe('test bridge token list', () => {
async function validateBridgeToken(network: 'testnet' | 'mainnet', tokenList: BridgeToken[]) {
Expand All @@ -24,7 +25,18 @@ describe('test bridge token list', () => {
}
}

test('testnet:bridge token list', async () => {
test('mainnet:bridge token list', async () => {
await validateBridgeToken('mainnet', mainnetBridgeTokens)
}, 90000)

test('mainnet:reward token list', async () => {
const bridgeChain = getBridgeChain('mainnet', CHAIN_ID_BSC)
const tokenList = BscMainnet.tokensForReward
for (const token of tokenList) {
const tokenMetadata = await bridgeChain.getTokenMetadata(token.id)
if (tokenMetadata.decimals !== token.decimals) {
throw new Error(`Invalid token decimals in reward token list, expected ${tokenMetadata.decimals}, got ${token.decimals}`)
}
}
}, 90000)
})

0 comments on commit fc15359

Please sign in to comment.