本文整理匯總了TypeScript中Sinon.assert.called方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript assert.called方法的具體用法?TypeScript assert.called怎麽用?TypeScript assert.called使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sinon.assert
的用法示例。
在下文中一共展示了assert.called方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: test
test("test watch", () => {
const am = genAM();
const spy1 = sinon.spy();
const spy2 = sinon.spy();
am.addAttribute(genAttr(NSIdentity.fromFQN("hoge.aaa"), () => {
spy1("watch");
}));
am.addAttribute(genAttr(NSIdentity.fromFQN("hoge.aaa"), () => {
spy2("watch");
}));
am.watch(NSIdentity.guess("hoge.aaa"), (a, b, c) => { /*do nothing*/ });
sinon.assert.called(spy1);
sinon.assert.called(spy2);
});
示例2: test
test('calls indices.delete', async () => {
const callCluster = sinon.spy(async (path: string, { index }: any) => {
expect(path).toEqual('indices.delete');
expect(index).toEqual('.lotr');
});
await Index.deleteIndex(callCluster, '.lotr');
sinon.assert.called(callCluster);
});
示例3: test
test('calls indices.create', async () => {
const callCluster = sinon.spy(async (path: string, { body, index }: any) => {
expect(path).toEqual('indices.create');
expect(body).toEqual({ mappings: { foo: 'bar' } });
expect(index).toEqual('.abcd');
});
await Index.createIndex(callCluster, '.abcd', { foo: 'bar' } as any);
sinon.assert.called(callCluster);
});
示例4: test
test("Broadcast message with range should work correctly", (t) => {
const testNode3 = rootNode.children[0];
resetSpies();
testNode3.enabled = true;
rootNode.broadcastMessage(1, "onTest");
sinon.assert.called(testComponent3Spy);
sinon.assert.notCalled(testComponent2Spy);
sinon.assert.notCalled(testComponentOptionalSpy);
sinon.assert.notCalled(testComponent1Spy);
});
示例5: test
test('it calls indices.putMapping', async () => {
const callCluster = sinon.spy(async (path: string, { body, type, index }: any) => {
expect(path).toEqual('indices.putMapping');
expect(index).toEqual('.shazm');
expect(body).toEqual({
dynamic: 'strict',
properties: {
foo: 'bar',
},
});
});
await Index.putMappings(callCluster, '.shazm', {
dynamic: 'strict',
properties: {
foo: 'bar',
},
});
sinon.assert.called(callCluster);
});
示例6: it
it("enableCircularCheck option is true", () => {
const result = plainToClass<User, Object>(User, user, { enableCircularCheck: true });
sinon.assert.called(isCircularSpy);
});
示例7: setTimeout
setTimeout(() => {
sinon.assert.called(postStub);
}, ReportingLoopIntervalInMs + 100);