本文整理汇总了TypeScript中Sinon.SinonSpy.getCall方法的典型用法代码示例。如果您正苦于以下问题:TypeScript SinonSpy.getCall方法的具体用法?TypeScript SinonSpy.getCall怎么用?TypeScript SinonSpy.getCall使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sinon.SinonSpy
的用法示例。
在下文中一共展示了SinonSpy.getCall方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should return unmuted dappIds array in peer obj without height', () => {
const expectedPeer = {
broadhash: '',
clock : '',
dappid : ['dappId', 'dappId2'],
height : '',
ip : '127.0.0.1',
nonce : '',
os : '',
port : 1010,
state : 2,
updated : '',
version : '',
};
peer.dappid = ['dappId', 'dappId2'];
const normalized = instance.normalize(Object.assign({}, peer));
expect(parseIntSpy.calledTwice).to.be.true;
expect(parseIntSpy.firstCall.args.length).to.equal(2);
expect(parseIntSpy.firstCall.args[0]).to.equal(peer.port);
expect(parseIntSpy.firstCall.args[1]).to.equal(0);
expect(parseIntSpy.getCall(1).args.length).to.equal(2);
expect(parseIntSpy.getCall(1).args[0]).to.equal(peer.state);
expect(parseIntSpy.getCall(1).args[1]).to.equal(PeerState.DISCONNECTED);
expect(normalized).to.deep.equal(expectedPeer);
});
示例2: expect
.then(([result, response, descriptor]) => {
// promise results
expect(result).to.be.instanceof(FragmentResult);
expect(result.data).to.deep.equal([{ id: 1, name: 'FOO JOE' }]);
expect(response).to.have.all.keys([
'code',
'config',
'data',
'headers',
'request',
'status',
'statusText'
]);
expect(descriptor).to.equal(spyStore_touchResource.getCall(0).args[0]);
// hooks
expect(spyMutableUsers_generateDescriptor.callCount).to.equal(1);
expect(spyStore_touchResource.callCount).to.equal(1);
expect(spyStore_touchResource.getCall(0).args[0]).to.deep.match(expectedDescriptor);
expect(spyStore_updateResource.callCount).to.equal(1);
expect(spyStore_updateResource.getCall(0).args[1]).to.deep.equal({
id: responseData.id,
name: responseData.name.toUpperCase()
});
expect(spyStore_destroyResource.callCount).to.equal(0);
}, () => {
示例3: useFakeClock
useFakeClock(clock=>{
cache.get({
numAsString:"5"
});
clock.tick(100);
assert.equal(fetch.getCall(0).args[1], 25, "first static dependency passed in correctly");
assert.equal(fetch.getCall(0).args[2], 3, "second static dependency passed in correctly");
});
示例4: it
it('should invoke default handler when none specified', () => {
const descriptor = new ResourceDescriptor(null, IActionType.get, schema.users.__stack);
processResponse(descriptor, dataCollectionUsers);
expect(spy_defaultHandler.callCount).to.equal(1);
expect(spy_defaultHandler.getCall(0).args[0]).to.equal(descriptor);
expect(spy_defaultHandler.getCall(0).args[1]).to.equal(dataCollectionUsers);
});
示例5: it
it('should forward to internal extend', () => {
const arg1 = { foo: 123 };
const fn1 = () => {};
configurable.withParams(arg1, fn1);
expect(spyOptionsExtend.callCount).to.equal(0);
expect(spyParamsExtend.callCount).to.equal(1);
expect(spyQueryParamsExtend.callCount).to.equal(0);
expect(spyParamsExtend.getCall(0).args[0]).to.equal(arg1);
expect(spyParamsExtend.getCall(0).args[1]).to.equal(fn1);
});
示例6: expect
allControllers.forEach((controller, index) => {
const symbol = getMetadataSpy.getCall(index).returnValue;
expect(containerStub.bindings[symbol]).to.be.deep.equal([{
inSingletonScope: true,
to : controller.name,
}]);
});
示例7: it
it('should call supersha.sha256', async () => {
await instance.loadDelegates();
expect(sha256Spy.callCount).to.be.equal(2);
expect(sha256Spy.getCall(0).args[0]).to.be.deep.equal(Buffer.from('secret1', 'utf-8'));
expect(sha256Spy.getCall(1).args[0]).to.be.deep.equal(Buffer.from('secret2', 'utf-8'));
});