2019-06-20 00:20:09 +02:00
|
|
|
import { assert } from 'chai'
|
2020-01-30 22:08:18 +01:00
|
|
|
import ContractHandler from '../../../src/keeper/ContractHandler'
|
|
|
|
import { Ocean } from '../../../src/ocean/Ocean'
|
2019-06-20 00:20:09 +02:00
|
|
|
import config from '../config'
|
2018-10-16 14:56:18 +02:00
|
|
|
|
2019-06-20 00:20:09 +02:00
|
|
|
describe('ContractHandler', () => {
|
2019-03-21 02:56:58 +01:00
|
|
|
let contractHandler: ContractHandler
|
2018-10-16 14:56:18 +02:00
|
|
|
|
2018-10-26 10:40:46 +02:00
|
|
|
before(async () => {
|
2019-08-15 14:13:21 +02:00
|
|
|
const { instanceConfig } = (await Ocean.getInstance(config)) as any
|
2019-03-21 02:56:58 +01:00
|
|
|
|
|
|
|
contractHandler = new ContractHandler(instanceConfig)
|
2018-10-26 10:40:46 +02:00
|
|
|
})
|
|
|
|
|
2019-06-20 00:20:09 +02:00
|
|
|
describe('#get()', () => {
|
|
|
|
it('should load and get OceanToken correctly', async () => {
|
|
|
|
assert(await contractHandler.get('OceanToken'))
|
2018-10-16 14:56:18 +02:00
|
|
|
})
|
|
|
|
|
2020-05-19 16:15:56 +02:00
|
|
|
it('should fail to load an unknown contract', (done) => {
|
2019-06-20 00:20:09 +02:00
|
|
|
contractHandler.get('OceanXXX').catch(() => {
|
|
|
|
done()
|
|
|
|
})
|
2018-10-18 09:19:10 +02:00
|
|
|
})
|
2018-10-16 14:56:18 +02:00
|
|
|
})
|
|
|
|
})
|