mirror of
https://github.com/oceanprotocol/ocean.js.git
synced 2024-11-26 20:39:05 +01:00
add config helper test
This commit is contained in:
parent
07bb1bfde0
commit
ba53d6ab6a
@ -1,7 +1,7 @@
|
|||||||
import Config from '../models/Config'
|
import Config from '../models/Config'
|
||||||
|
|
||||||
export interface ConfigHelperConfig extends Config {
|
export interface ConfigHelperConfig extends Config {
|
||||||
chainId?: number
|
chainId: 1 | 4 | number
|
||||||
network: 'mainnet' | 'rinkeby' | 'development' | string
|
network: 'mainnet' | 'rinkeby' | 'development' | string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
23
test/unit/utils/ConfigHelper.test.ts
Normal file
23
test/unit/utils/ConfigHelper.test.ts
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
import { assert } from 'chai'
|
||||||
|
import { ConfigHelper } from '../../../src/lib'
|
||||||
|
|
||||||
|
describe('ConfigHelper', () => {
|
||||||
|
it('should get config based on network name', () => {
|
||||||
|
const network = 'rinkeby'
|
||||||
|
const config = new ConfigHelper().getConfig(network)
|
||||||
|
assert(config.network === network)
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should get config based on network name, and add passed Infura ID', () => {
|
||||||
|
const network = 'rinkeby'
|
||||||
|
const infuraId = 'helloInfura'
|
||||||
|
const config = new ConfigHelper().getConfig(network, infuraId)
|
||||||
|
assert(config.nodeUri.includes(infuraId))
|
||||||
|
})
|
||||||
|
|
||||||
|
it('should get config based on chain ID', () => {
|
||||||
|
const chainId = 4
|
||||||
|
const config = new ConfigHelper().getConfigById(chainId)
|
||||||
|
assert(config.chainId === chainId)
|
||||||
|
})
|
||||||
|
})
|
Loading…
x
Reference in New Issue
Block a user