當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。