it('should call "addModule"', () => { const addModuleSpy = sinon.spy(container, 'addModule'); container.addDynamicModules([Test] as any, []); expect(addModuleSpy.called).to.be.true; });
beforeEach('setup', () => { channel = pigeon.channel('a'); channelB = pigeon.channel('b'); cb = sinon.spy(); });
it('should return observable', () => { const fn = server.createUnaryServiceMethod(sinon.spy()); expect(fn).to.be.a('function'); });
beforeEach(() => { consoleInfo = spy(console, "info"); });
beforeEach(() => { // Listen to console.error calls. spy = sinon.spy(console, 'error'); });
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);
}, '/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();
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; });
it('should create guards context', () => { const guardsCreateSpy = sinon.spy(guardsContextCreator, 'create'); contextCreator.create(instance, instance.test, module); expect(guardsCreateSpy.calledWith(instance, instance.test, module)).to.be .true; });
beforeEach(() => { callback = sinon.spy(console, 'log'); stdoutWriteMock = new StdoutWriteMock(process.stdout.write); });