Commit 08a8f669 authored by Moody Salem's avatar Moody Salem

fix: all supported chain ids should not include the string keys of the enum

parent 95d91c85
import { ALL_SUPPORTED_CHAIN_IDS, SupportedChainId } from './chains'
describe('chains', () => {
describe('ALL_SUPPORTED_CHAIN_IDS', () => {
it('contains all the values in the SupportedChainId enum', () => {
Object.values(SupportedChainId).forEach((chainId) => {
if (typeof chainId === 'number') expect(ALL_SUPPORTED_CHAIN_IDS.includes(chainId as number)).toBeTruthy()
})
})
it('contains no duplicates', () => {
const set = new Set<number>()
ALL_SUPPORTED_CHAIN_IDS.forEach((chainId) => {
expect(set.has(chainId)).toEqual(false)
set.add(chainId)
})
})
it('all values are in the SupportedChainId mapping', () => {
ALL_SUPPORTED_CHAIN_IDS.forEach((chainId) => {
// takes advantage of the reverse mapping
expect(SupportedChainId[chainId]).toBeTruthy()
})
})
})
})
......@@ -14,7 +14,18 @@ export enum SupportedChainId {
OPTIMISTIC_KOVAN = 69,
}
export const ALL_SUPPORTED_CHAIN_IDS: SupportedChainId[] = Object.values(SupportedChainId) as SupportedChainId[]
export const ALL_SUPPORTED_CHAIN_IDS: SupportedChainId[] = [
SupportedChainId.MAINNET,
SupportedChainId.ROPSTEN,
SupportedChainId.RINKEBY,
SupportedChainId.GOERLI,
SupportedChainId.KOVAN,
SupportedChainId.ARBITRUM_ONE,
SupportedChainId.ARBITRUM_RINKEBY,
SupportedChainId.OPTIMISM,
SupportedChainId.OPTIMISTIC_KOVAN,
]
export const L1_CHAIN_IDS = [
SupportedChainId.MAINNET,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment