本文整理汇总了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);