本文整理汇总了TypeScript中Sinon.spy函数的典型用法代码示例。如果您正苦于以下问题:TypeScript spy函数的具体用法?TypeScript spy怎么用?TypeScript spy使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了spy函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it('should call "addModule"', () => {
const addModuleSpy = sinon.spy(container, 'addModule');
container.addDynamicModules([Test] as any, []);
expect(addModuleSpy.called).to.be.true;
});
开发者ID:SARAVANA1501,项目名称:nest,代码行数:5,代码来源:container.spec.ts
示例2: beforeEach
beforeEach('setup', () => {
channel = pigeon.channel('a');
channelB = pigeon.channel('b');
cb = sinon.spy();
});
开发者ID:w3tecch,项目名称:pigeon.js,代码行数:5,代码来源:channel.spec.ts
示例3: it
it('should return observable', () => {
const fn = server.createUnaryServiceMethod(sinon.spy());
expect(fn).to.be.a('function');
});
开发者ID:a1r0,项目名称:nest,代码行数:4,代码来源:server-grpc.spec.ts
示例4: beforeEach
beforeEach(() => { consoleInfo = spy(console, "info"); });
开发者ID:iskandersierra,项目名称:decos,代码行数:1,代码来源:log.spec.ts
示例5: beforeEach
beforeEach(() => {
// Listen to console.error calls.
spy = sinon.spy(console, 'error');
});
开发者ID:RameshBhupathi,项目名称:firebase-js-sdk,代码行数:4,代码来源:subscribe.test.ts
示例6: registerSuite
if (timerHandle) {
timerHandle.destroy();
timerHandle = null;
}
}
registerSuite('utility functions', {
afterEach() {
destroyTimerHandle();
},
tests: {
createTimer: {
destroy(this: any) {
const dfd = this.async(1000);
const spy = sinon.spy();
timerHandle = util.createTimer(spy, 100);
setTimeout(function () {
destroyTimerHandle();
}, 50);
setTimeout(dfd.callback(function () {
assert.strictEqual(spy.callCount, 0);
}), 110);
},
timeout(this: any) {
const dfd = this.async(1000);
const spy = sinon.spy();
timerHandle = util.createTimer(spy, 100);
开发者ID:bryanforbes,项目名称:core,代码行数:31,代码来源:util.ts
示例7: callback
},
'/path/to/second': {
foo: 'bar'
},
'/path/bar': {
bar: 'baz'
},
'/other': {
value: 'The quick brown fox jumped over the lazy dog.'
},
'bundle!lazy'(callback: (value: any) => any) {
callback({ value: 'lazy loaded' });
},
'plugin!normalize': {
normalize: sinon.stub().returns('normalized/path/to/resource'),
load: sinon.spy()
},
'plugin!resource/id': {
load: sinon.spy()
},
'plugin!./resource/id': {
load: sinon.spy()
},
'parent/plugin!./resource/id': {
load: sinon.spy()
}
});
},
afterEach() {
setModules();
开发者ID:dylans,项目名称:core,代码行数:31,代码来源:webpack.ts
示例8: it
it('should create exception handler', () => {
const handlerCreateSpy = sinon.spy(exceptionFiltersContext, 'create');
contextCreator.create(instance, instance.test, module);
expect(handlerCreateSpy.calledWith(instance, instance.test)).to.be.true;
});
开发者ID:SARAVANA1501,项目名称:nest,代码行数:5,代码来源:rpc-context-creator.spec.ts
示例9: beforeEach
beforeEach(() => {
callback = sinon.spy(console, 'log');
stdoutWriteMock = new StdoutWriteMock(process.stdout.write);
});
开发者ID:dssoft32,项目名称:javascript-obfuscator,代码行数:4,代码来源:JavaScriptObfuscatorCLI.spec.ts
注:本文中的Sinon.spy函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论