本文整理汇总了TypeScript中@quenk/test/lib/assert.assert函数的典型用法代码示例。如果您正苦于以下问题:TypeScript assert函数的具体用法?TypeScript assert怎么用?TypeScript assert使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了assert函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should correctly test string', function() {
let email = /.+\@.+\..+/;
assert(matches(email)('m12@emale.com').takeRight()).equal('m12@emale.com');
assert(matches(email)('12').takeLeft()).be.instance.of(PrimFailure);
});
示例2: it
it('should work', function() {
assert(range(1, 3)([]).takeLeft().explain()).equal('range.min');
assert(range(1, 3)([1, 2, 3, 4]).takeLeft().explain()).equal('range.max');
assert(range(1, 3)([1, 2, 3]).takeRight()).equate([1, 2, 3]);
});
示例3: it
it('should fail if the value specified is not a boolean', function() {
assert(isBoolean(true).takeRight()).be.true();
assert(isBoolean(false).takeRight()).be.false();
assert(isBoolean('12').takeLeft()).be.instance.of(PrimFailure);
});
示例4: it
it('should work', function() {
assert(isRecord({}).takeRight()).equate({});
assert(isRecord('z').takeLeft().explain({})).equal('isRecord');
assert(isRecord([]).takeLeft().explain({})).equal('isRecord');
});
示例5: assert
const shouldWorkWithNestedConditions = (condition: Precondition<object, object>) => {
assert(condition(validAccess).takeRight()).equate(validAccess);
assert(condition(invalidAccess).takeLeft().explain())
.equate({
network: 'check', user: { roles: 'check' }, previous: { age: 'check' }
});
}
示例6: it
it('should correctly test string, number or arrays', function() {
let test = range(3, 5);
assert(test(1).takeLeft().explain()).equal('range.min');
assert(test(6).takeLeft().explain()).equal('range.max');
assert(test(3).takeRight()).equal(3);
assert(test(4).takeRight()).equal(4);
assert(test(5).takeRight()).equal(5);
})