本文整理汇总了TypeScript中chai.assert.ok方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.ok方法的具体用法?TypeScript assert.ok怎么用?TypeScript assert.ok使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chai.assert
的用法示例。
在下文中一共展示了assert.ok方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: async
export const credentialCreateWithMsgId = async (data?: ICredentialCreateWithMsgId) => {
if (!data) {
data = await dataCredentialCreateWithMsgId()
}
const credential = await Credential.createWithMsgId(data)
assert.notEqual(credential.handle, undefined)
assert.equal(credential.sourceId, data.sourceId)
assert.ok(credential.credOffer)
return credential
}
示例2: it
it('should accept tsconfigs that typescript accepts', () => {
assert.ok(
withCustomConfig(
// need to navigate to root because tests run on compiled tests
// and tsc does not include json files
path.join(__dirname, '../../src/__tests__/data/tsconfig.json'),
{}
)
);
});
示例3: it
it('can compile a unifying object matcher', () => {
let match = compileMatcher({ foo: simple('x'), bar: simple('y'), baz: simple('x') });
let successContext = new Context();
assert.ok(match({ foo: 1, bar: 2, baz: 1 }, successContext));
assert.deepEqual(flattenPrototype(successContext.expose()), { x: 1, y: 2 });
let failureContext = new Context();
assert.notOk(match({ foo: 1, bar: 2, baz: 3 }, failureContext));
assert.deepEqual(flattenPrototype(failureContext.expose()), {});
});
示例4: createOrderForValidData
@test('createOrder() completes without throwing an error')
public async createOrderForValidData() {
let { id } = await createOrder(VALID_ORDER_DATA, [
{ productid: 1, quantity: 3, discount: 0, unitprice: 3.0 }
]);
if (typeof id === 'undefined') {
throw new Error('createOrder() should return an object with an id');
}
assert.ok(id, 'createOrder() returns an object with an id');
}
示例5:
.then((deployUnit) => {
assert.ok(deployUnit.id);
assert.equal(deployUnit.name, newDu.name);
assert.equal(deployUnit.version, newDu.version);
assert.equal(deployUnit.platform, newDu.platform);
assert.equal(deployUnit.tdefName, 'Ticker');
assert.equal(deployUnit.tdefVersion, 3);
assert.equal(deployUnit.namespace, 'kevoree');
createdDu = deployUnit;
});