当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript SinonStub.reset方法代码示例

本文整理汇总了TypeScript中Sinon.SinonStub.reset方法的典型用法代码示例。如果您正苦于以下问题:TypeScript SinonStub.reset方法的具体用法?TypeScript SinonStub.reset怎么用?TypeScript SinonStub.reset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sinon.SinonStub的用法示例。


在下文中一共展示了SinonStub.reset方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: constructor

	public constructor(public readonly settingName: string | null,
											public readonly settingValue: string | null) {
		setting.name = this.settingName;
		setting.value = this.settingValue;
		saveStub.reset();
		removeStub.reset();
	}
开发者ID:scottohara,项目名称:tvmanager,代码行数:7,代码来源:setting-model-mock.ts

示例2: it

 it('should call getSnapshotRounds once or twice', async () => {
   getSnapshotRoundsStub.returns(0);
   await doCall();
   expect(getSnapshotRoundsStub.calledOnce).to.be.true;
   getSnapshotRoundsStub.reset();
   getSnapshotRoundsStub.returns(12);
   dbHelpersStub.enqueueResponse('performOps', Promise.resolve());
   await doCall();
   expect(getSnapshotRoundsStub.calledTwice).to.be.true;
 });
开发者ID:RiseVision,项目名称:rise-node,代码行数:10,代码来源:rounds.spec.ts

示例3: registerSuite

const testPkg = { 'testKey': 'testValue' };
const testInterval = 100;

registerSuite({
	name: 'updateNotifier',
	'setup'() {
		mockery.enable({
			warnOnUnregistered: false
		});

		mockery.registerMock('update-notifier', updateNotifierStub);

		updateNotifier = require('intern/dojo/node!./../../src/updateNotifier').default;
	},
	'beforeEach'() {
		notifyStub.reset();
		updateNotifierStub.reset();
	},
	'teardown'() {
		mockery.deregisterAll();
		mockery.disable();
	},
	'Should call update-notifier with the passed arguments'() {
		updateNotifier(testPkg, testInterval);
		assert.isTrue(updateNotifierStub.calledOnce);
		assert.isTrue(updateNotifierStub.firstCall.calledWith({
			'pkg': testPkg,
			'updateCheckInterval': testInterval
		}));
	},
	'Should default interval to zero if none passed'() {
开发者ID:dylans,项目名称:cli,代码行数:31,代码来源:updateNotifier.ts

示例4: loadTasks

		);

		loadTasks({
			fs: fs,
			execa: {
				shell: shell
			}
		});
	},
	teardown() {
		symlink.restore();
		unloadTasks();
	},

	beforeEach() {
		symlink.reset();
		shell.reset();
	},

	_link() {
		runGruntTask('_link');

		assert.isTrue(symlink.calledTwice);
		assert.isTrue(symlink.firstCall.calledWith(path.join(cwd, 'node_modules'), path.join(outputPath, 'node_modules'), 'junction'));
		assert.isTrue(symlink.secondCall.calledWith(path.join(cwd, 'package.json'), path.join(outputPath, 'package.json'), 'file'));
		assert.isTrue(shell.calledOnce);
		assert.isTrue(shell.calledWith('npm link', { cwd: outputPath }));
	},

	link: {
		beforeEach() {
开发者ID:dylans,项目名称:grunt-dojo2,代码行数:31,代码来源:link.ts

示例5: stub

	{
		groupName: 'group2',
		commands: [{ commandName: 'command1' }, { commandName: 'failcommand', fails: true }]
	}
];
let groupMap: any;
let commandHelper: any;
const templateStub: SinonStub = stub();

const context = {
	testKey: 'testValue'
};

registerSuite('CommandHelper', {
	beforeEach() {
		templateStub.reset();
		mockery.enable({ warnOnUnregistered: false, useCleanCache: true });

		mockery.registerMock('./template', {
			default: templateStub
		});

		groupMap = getGroupMap(groupDef);
		const commandHelperCtor = require('../../src/CommandHelper').default;
		commandHelper = new commandHelperCtor(groupMap, context, configurationHelperFactory);
	},

	afterEach() {
		mockery.deregisterAll();
		mockery.disable();
	},
开发者ID:dojo,项目名称:cli,代码行数:31,代码来源:CommandHelper.ts

示例6: it

      it('should throw error if query.address and query.publicKey are empty', async () => {
        isEmptyStub.reset();
        isEmptyStub.returns(true);

        await expect(instance.getAccount(query)).to.be.rejectedWith('Missing required property: address or publicKey');
      });
开发者ID:RiseVision,项目名称:rise-node,代码行数:6,代码来源:accountsAPI.spec.ts

示例7: beforeEach

		beforeEach((): void => {
			openDbStub.reset();
			callback.reset();
			DatabaseService["initialVersion"] = "";
		});
开发者ID:scottohara,项目名称:tvmanager,代码行数:5,代码来源:database-service_spec.ts

示例8: loadModule

				rm: rmStub
			},
			fs: {
				chmodSync: chmodStub,
				existsSync: existsStub
			},
			'./process': {
				'exec': execStub,
				'spawn': spawnStub
			}
		};
		Publisher = loadModule('grunt-dojo2/tasks/util/Publisher', mocks);
	},

	beforeEach() {
		cpStub.reset();
		execStub.reset();
		spawnStub.reset();
		rmStub.reset();
		chmodStub.reset();
		existsStub.reset();
		log.writeln.reset();

		spawnStub.returns({
			stdout: 'result'
		});
	},

	teardown() {
		unloadTasks();
	},
开发者ID:dylans,项目名称:grunt-dojo2,代码行数:31,代码来源:Publisher.ts


注:本文中的Sinon.SinonStub.reset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。