當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript SinonStub.calledWith方法代碼示例

本文整理匯總了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;
 });
開發者ID:RiseVision,項目名稱:rise-node,代碼行數:28,代碼來源:account.spec.ts

示例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);
 });
開發者ID:getsentry,項目名稱:raven-js,代碼行數:11,代碼來源:fetch.test.ts

示例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');
開發者ID:dylans,項目名稱:grunt-dojo2,代碼行數:30,代碼來源:link.ts

示例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.'));
		}
	}
});
開發者ID:dylans,項目名稱:grunt-dojo2,代碼行數:30,代碼來源:installPeerDependencies.ts

示例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"
				}
開發者ID:dylans,項目名稱:grunt-dojo2,代碼行數:30,代碼來源:ts.ts

示例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));
				}
			}
		}
開發者ID:dojo,項目名稱:cli,代碼行數:31,代碼來源:registerCommands.ts


注:本文中的Sinon.SinonStub.calledWith方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。