From fc153591faba268398b33acfa055c878c49f7990 Mon Sep 17 00:00:00 2001 From: lbqds Date: Mon, 4 Nov 2024 18:05:23 +0800 Subject: [PATCH] Add tests to check the reward token list --- token-list/test/BridgeToken.test.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/token-list/test/BridgeToken.test.ts b/token-list/test/BridgeToken.test.ts index a527b3e6..69711008 100644 --- a/token-list/test/BridgeToken.test.ts +++ b/token-list/test/BridgeToken.test.ts @@ -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[]) { @@ -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) })