示例#1
0
 it('should call "addModule"', () => {
   const addModuleSpy = sinon.spy(container, 'addModule');
   container.addDynamicModules([Test] as any, []);
   expect(addModuleSpy.called).to.be.true;
 });
示例#2
0
 beforeEach('setup', () => {
   channel = pigeon.channel('a');
   channelB = pigeon.channel('b');
   cb = sinon.spy();
 });
示例#3
0
 it('should return observable', () => {
   const fn = server.createUnaryServiceMethod(sinon.spy());
   expect(fn).to.be.a('function');
 });
示例#4
0
 beforeEach(() => { consoleInfo = spy(console, "info"); });
 beforeEach(() => {
   // Listen to console.error calls.
   spy = sinon.spy(console, 'error');
 });
示例#6
0
文件: util.ts 项目: bryanforbes/core
	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);
示例#7
0
文件: webpack.ts 项目: dylans/core
			},
			'/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);
 });