本文整理汇总了TypeScript中chai.expect类的典型用法代码示例。如果您正苦于以下问题:TypeScript expect类的具体用法?TypeScript expect怎么用?TypeScript expect使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了expect类的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it("does not time out if a timeout is set and not exceeded", async () => {
try {
await db.query(aql`RETURN SLEEP(0.01)`, { timeout: 1000 });
} catch (err) {
expect.fail();
}
});
示例2: function
readable_mock._do_readToStream = function(offset:number, size:number) {
expect.fail(); // should not get to this position
return new Promise<Buffer>((resolve:PromiseResolve<Buffer>, reject:PromiseReject) => {
reject(new Errors.InvalidArguments());
});
};
示例3: it
it(`should return 400 when mount is invalid for ${desc}`, async () => {
try {
await method(`/dev/null`);
expect.fail();
} catch (e) {
expect(e).to.be.instanceOf(ArangoError);
expect(e.code).to.equal(400);
}
});
示例4: it
it("deletes the given document", async () => {
await collection.remove(key);
try {
await collection.document(key);
} catch (e) {
return;
}
expect.fail();
});
示例5: it
it("should throw if view does not exists", async () => {
try {
await db.arangoSearchView("no").get();
} catch (err) {
expect(err).to.have.property("errorNum", 1203);
return;
}
expect.fail("should throw");
});
示例6: it
it("deletes the given vertex", async () => {
await collection.remove(key);
try {
await collection.vertex(key);
} catch (e) {
return;
}
expect.fail();
});
示例7: it
it('throws an error if the embedded type is undefined', async () => {
// Manually call the decorator
try {
embed([undefined])(Bundle, 'someUndefinedEmbeds', null)
expect.fail()
} catch(e) {
expect(e.message).to.eq('Type of @embeds decorator at Function:someUndefinedEmbeds is undefined')
}
})
示例8: it
it("should throw if collection does not exist", async () => {
try {
await db.collection("no").get();
} catch (e) {
expect(e).to.have.property("errorNum", COLLECTION_NOT_FOUND);
return;
}
expect.fail("should throw");
});
示例9: it
it("fails if the database does not exist", async () => {
db.useDatabase("__does_not_exist__");
try {
await db.get();
} catch (e) {
expect(e).to.be.an.instanceof(ArangoError);
return;
}
expect.fail("should not succeed");
});
示例10: catch
nonSystemCollections.map(async name => {
let doc;
try {
doc = await db.collection(name).document("example");
} catch (e) {
expect(e).to.be.an.instanceof(ArangoError);
return;
}
expect.fail(`Expected document to be destroyed: ${doc._id}`);
})