本文整理汇总了TypeScript中Sinon.assert.calledThrice方法的典型用法代码示例。如果您正苦于以下问题:TypeScript assert.calledThrice方法的具体用法?TypeScript assert.calledThrice怎么用?TypeScript assert.calledThrice使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sinon.assert
的用法示例。
在下文中一共展示了assert.calledThrice方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('calls each registered getter once each call', async () => {
const authScope = new AuthScopeService();
const user = {} as any;
const request = requestFixture();
const getter1 = sinon.stub();
const getter2 = sinon.stub();
const getter3 = sinon.stub();
authScope.registerGetter(getter1);
authScope.registerGetter(getter2);
authScope.registerGetter(getter3);
await authScope.getForRequestAndUser(request, user);
sinon.assert.calledOnce(getter1);
sinon.assert.calledOnce(getter2);
sinon.assert.calledOnce(getter3);
await authScope.getForRequestAndUser(request, user);
sinon.assert.calledTwice(getter1);
sinon.assert.calledTwice(getter2);
sinon.assert.calledTwice(getter3);
await authScope.getForRequestAndUser(request, user);
sinon.assert.calledThrice(getter1);
sinon.assert.calledThrice(getter2);
sinon.assert.calledThrice(getter3);
});
示例2: testSchedule
async function testSchedule(task: TaskInstance) {
const callCluster = sinon.stub();
callCluster.withArgs('index').returns(
Promise.resolve({
_id: 'testid',
_seq_no: 3344,
_primary_term: 3344,
})
);
callCluster.withArgs('indices.getTemplate').returns(Promise.resolve({ tasky: {} }));
const store = new TaskStore({
callCluster,
getKibanaUuid,
logger: mockLogger(),
index: 'tasky',
maxAttempts: 2,
supportedTypes: ['report', 'dernstraight', 'yawn'],
});
await store.init();
const result = await store.schedule(task);
sinon.assert.calledThrice(callCluster);
return { result, callCluster, arg: callCluster.args[2][1] };
}
示例3:
promizr.concat(list, iterator).then(results => {
sinon.assert.calledThrice(spy);
spy.getCall(0).args[0].should.equal(list[1]);
spy.getCall(1).args[0].should.equal(list[2]);
spy.getCall(2).args[0].should.equal(list[0]);
}).then(done, done);
示例4: it
it("", () => {
var reactions = reactionsHelpers.createFakeReactions(3),
expectedResolution = { value: "Yoopie !" };
abstract.triggerPromiseReaction(reactions, expectedResolution);
sinon.assert.calledThrice(enqueueTaskStub);
});