本文整理汇总了TypeScript中code.expect函数的典型用法代码示例。如果您正苦于以下问题:TypeScript expect函数的具体用法?TypeScript expect怎么用?TypeScript expect使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了expect函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: expect
lab.test('has correct .version', done => {
// The transpiled output for this file is 28 lines long.
// 'npm run fail' correctly reports a failure in line 30:
const expectedVersion = process.env.BAD_VERSION || '1.0.0';
expect(metadata.version, 'version').to.equal(expectedVersion);
done();
})
示例2: expect
import { expect, settings, fail, count, incomplete, thrownAt } from "code";
expect(10).to.be.above(5);
expect("abc").to.be.a.string();
expect([1, 2]).to.be.an.array();
expect(20).to.be.at.least(20);
expect("abc").to.have.length(3);
expect("abc").to.be.a.string().and.contain(["a", "b"]);
expect(6).to.be.in.range(5, 6);
expect(10).to.not.be.above(20);
expect([1, 2, 3]).to.shallow.include(3);
expect([1, 1, 2]).to.only.include([1, 2]);
expect([1, 2]).to.once.include([1, 2]);
expect([1, 2, 3]).to.part.include([1, 4]);
expect(10, "Age").to.be.above(5);
const func = function() { return arguments; }; // tslint:disable-line only-arrow-functions
expect(func()).to.be.arguments();
expect([1, 2]).to.be.an.array();
expect(true).to.be.a.boolean();
expect(new Date()).to.be.a.date();
const err = new Error("Oops an error occured.");
expect(err).to.be.an.error();
expect(err).to.be.an.error(Error);
expect(err).to.be.an.error("Oops an error occured.");
示例3: expect
lab.test('test1 returns true when 1 + 1 equals 2', (done) => {
expect(1 + 1).to.equal(2);
done();
});
示例4: done
lab.it('returns true when 1 + 1 equals 2', (done) => {
Code.expect(1 + 2).to.equal(3);
done();
});
示例5: it
it('should run test2 normally', function(){
expect(1).to.equal(1);
})