本文整理汇总了TypeScript中chai.assert.ifError方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.ifError方法的具体用法?TypeScript assert.ifError怎么用?TypeScript assert.ifError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chai.assert
的用法示例。
在下文中一共展示了assert.ifError方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: resolve
redisClient.get(`client:${client.id}`, (err, result) => {
assert.ifError(err);
let c: Client = JSON.parse(result);
assert.equal(c.name, newName);
resolve(null);
})
示例2: done
proc.process({}, (err, output) => {
assert.ifError(err)
// small sanity tests on teh graph
const g = output!.parameters.graph
// taskWorkflow + 1 folder + 2 markers
assert.equal(Object.keys(g.nodes).length, 4)
done()
})
示例3: assert
act.run({someInput: true}, {startEnv: true}, (err, status) => {
assert.ifError(err)
assert.equal(status.status, 'success')
assert.deepEqual(status.info, {someRes: true})
const innerAct = act.activity as TestObjectActivity
assert(innerAct.runCalled)
done()
})
示例4: it
it("should create user trim spaces on email", async () => {
try {
let user = await userService.create("name", " email@email.com ", "password");
expect(user.email).to.equal("email@email.com");
} catch (err) {
assert.ifError(err, "Error when creating user trimming email");
}
});
示例5: Processor
Processor.getToProcess(startDir, store, (err, info) => {
assert.ifError(err)
const proc = new Processor(store, startDir, info!.files, info!.dirs)
proc.process({}, (err, output) => {
assert.ifError(err)
// small sanity tests on teh graph
const g = output!.parameters.graph
// taskWorkflow + 1 folder + 2 markers
assert.equal(Object.keys(g.nodes).length, 4)
done()
})
})
示例6:
Processor.filterToProcess(info!, store, (err, filtered) => {
assert.ifError(err)
assert.deepEqual(filtered!.files, ['bar.js', 'baz.js'])
assert.deepEqual(filtered!.dirs, [])
})