本文整理匯總了TypeScript中Sinon.SinonStub.calledWith方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript SinonStub.calledWith方法的具體用法?TypeScript SinonStub.calledWith怎麽用?TypeScript SinonStub.calledWith使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Sinon.SinonStub
的用法示例。
在下文中一共展示了SinonStub.calledWith方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: it
it('should use null scope when none of the above is provided (but the rest is)', async () => {
await account.getAll({ address: '1' }, [
'username',
'isDelegate',
'secondSignature',
'address',
'publicKey',
'secondPublicKey',
'balance',
'vote',
'rate',
'multimin',
'multilifetime',
'blockId',
'producedblocks',
'missedblocks',
'fees',
'rewards',
'virgin',
'u_isDelegate',
'u_secondSignature',
'u_username',
'u_balance',
'u_multilifetime',
'u_multimin',
]);
expect(scopeStub.calledWith(null)).is.true;
});
示例2: expect
return transport.sendEvent(payload).catch(res => {
expect(res.status).equal(403);
expect(fetch.calledOnce).equal(true);
expect(
fetch.calledWith(transportUrl, {
body: JSON.stringify(payload),
method: 'POST',
referrerPolicy: 'origin',
}),
).equal(true);
});
示例3: unloadTasks
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() {
run = stub(grunt.task, 'run');
},
afterEach() {
run.restore();
},
withDir() {
prepareOutputDirectory();
runGruntTask('link');
示例4: stub
grunt.initConfig({});
mockLogger = stub(grunt.log, 'error');
mockShell = stub();
mockShell
.withArgs('npm install my-dep@"1.0"').returns(Promise.resolve({}))
.withArgs('npm install error-dep@"1.0"').throws();
loadTasks({
child_process: {
execSync: mockShell
}
}, {
peerDependencies: {
'my-dep': '1.0',
'error-dep': '1.0'
}
});
},
runsCommands() {
runGruntTask('peerDepInstall');
assert.isTrue(mockShell.calledTwice);
assert.isTrue(mockShell.calledWith('npm install my-dep@"1.0"'));
assert.isTrue(mockShell.calledWith('npm install error-dep@"1.0"'));
assert.isTrue(mockLogger.called);
assert.isTrue(mockLogger.calledWith('failed.'));
}
}
});
示例5: dist
dist() {
runGruntTask('dojo-ts:dist');
assert.deepEqual(grunt.config('ts.dist'), {
tsconfig: {
passThrough: true,
tsconfig: '.tsconfigdist.json'
}
});
assert.isTrue(run.calledOnce);
assert.deepEqual(run.firstCall.args[ 0 ], [ 'ts:dist', 'clean:distTsconfig' ]);
assert.isTrue(write.calledOnce);
assert.isTrue(write.calledWith('.tsconfigdist.json'));
},
esm() {
grunt.initConfig({
distDirectory: outputPath,
tsconfig: {
"compilerOptions": {
"inlineSourceMap": true,
"inlineSources": true,
"listFiles": true,
"module": "commonjs",
"noImplicitAny": true,
"pretty": true,
"target": "es6"
}
示例6: getGroupMap
await yargsStub.command.firstCall.args[3]({ _: ['group'] });
assert.isTrue(consoleErrorStub.calledOnce);
assert.isTrue(consoleErrorStub.firstCall.calledWithMatch(errorMessage));
assert.isTrue(processExitStub.called);
},
async 'Should exit process with exitCode of 1 when no exitCode is returned'() {
groupMap = getGroupMap([
{
groupName: 'group1',
commands: [{ commandName: 'command1', fails: true }]
}
]);
registerCommands(yargsStub, groupMap);
await yargsStub.command.firstCall.args[3]({ _: ['group'] });
assert.isTrue(processExitStub.calledOnce);
assert.isTrue(processExitStub.calledWith(1));
},
async 'Should exit process with passed exit code'() {
groupMap = getGroupMap([
{
groupName: 'group1',
commands: [{ commandName: 'command1', fails: true, exitCode: 100 }]
}
]);
registerCommands(yargsStub, groupMap);
await yargsStub.command.firstCall.args[3]({ _: ['group'] });
assert.isTrue(processExitStub.calledOnce);
assert.isTrue(processExitStub.calledWith(100));
}
}
}