本文整理汇总了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();
}
示例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;
});
示例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'() {
示例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() {
示例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();
},
示例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');
});
示例7: beforeEach
beforeEach((): void => {
openDbStub.reset();
callback.reset();
DatabaseService["initialVersion"] = "";
});
示例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();
},