提交 e784ce4d 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

fix config unit test

上级 77f8cc75
......@@ -47,10 +47,21 @@ test('Config methods', t => {
})
test('Config puppetInstance', t => {
let instance = Config.puppetInstance()
t.falsy(instance, 'should empty initialy')
t.truthy(Config.puppetInstance({} as Puppet), 'should return instance in arg')
t.truthy(Config.puppetInstance(), 'should return instance after set')
t.falsy(Config.puppetInstance(null), 'should return null after set to null')
t.falsy(instance, 'should empty after set to null')
t.throws(() => {
Config.puppetInstance()
}, Error, 'should throw when not initialized')
const EXPECTED = {userId: 'test'}
const puppet = <Puppet>EXPECTED
Config.puppetInstance(puppet)
let instance = Config.puppetInstance(puppet)
t.deepEqual(instance, <Puppet>EXPECTED, 'should equal with initialized data')
Config.puppetInstance(null)
t.throws(() => {
Config.puppetInstance()
}, Error, 'should throw after set to null')
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册