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


TypeScript assert.default函数代码示例

本文整理汇总了TypeScript中assert.default函数的典型用法代码示例。如果您正苦于以下问题:TypeScript default函数的具体用法?TypeScript default怎么用?TypeScript default使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: loadConfigFromFile

export function loadConfigFromFile(fname: string): AppConfig {
  var jsonText = fs.readFileSync(fname, {encoding: "utf-8"});
  var config = JSON.parse(jsonText);
  assert(config.htmlSrcs !== void 0);
  if (config.dataDir === void 0) {
    config.dataDir = defaultValues.dataDir;
  }
  return config;
}
开发者ID:chirayuk,项目名称:i18n,代码行数:9,代码来源:config.ts

示例2: runValidations

 runValidations(() => {
     assert(tr.succeeded, "Should have succeeded");
     assert(tr.stdout.indexOf("loc_mock_ToolToInstall sdk 1.0.4") > -1, "should print to-be-installed info");
     assert(tr.stdout.indexOf("Checking local tool for dncs and version 1.0.4") > -1, "should check for local cached tool");
     assert(tr.stdout.indexOf("loc_mock_InstallingAfresh") == -1, "should not install fresh");
     assert(tr.stdout.indexOf("loc_mock_GettingDownloadUrls") == -1, "should not download");
     assert(tr.stdout.indexOf("loc_mock_UsingCachedTool") > -1, "should print that cached dir is being used");
     assert(tr.stdout.indexOf("Caching dir C:\\agent\\_temp\\someDir for tool dncs version 1.0.4") == -1, "should not update cache again");
     assert(tr.stdout.indexOf("prepending path: C:\\agent\\_tools\\oldCacheDir") > -1, "should pre-prend to PATH");
 }, tr, done);
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:10,代码来源:L0.ts

示例3: runValidations

 runValidations(() => {
     assert(tr.succeeded, "Should have succeeded");
     assert(tr.stdout.indexOf("virtualMachineExtensions.list is called") > -1, "virtualMachineExtensions.list function should have been called from azure-sdk");
     assert(tr.stdout.indexOf("virtualMachineExtensions.deleteMethod is called with resource testvmss1 and extension AzureVmssDeploymentTask") == -1, "virtualMachineExtensions.deleteMethod function should have been called from azure-sdk");
     assert(tr.stdout.indexOf("virtualMachineExtensions.createOrUpdate is called with resource testvmss1 and extension AzureVmssDeploymentTask") > -1, "virtualMachineExtensions.createOrUpdate function should have been called from azure-sdk");
     assert(tr.stdout.indexOf("virtualMachinesScaleSets.updateImage is called with RG: testrg1, VMSS: testvmss1 and imageurl : https://someurl") > -1, "virtualMachinesScaleSets.updateImage function should have been called from azure-sdk");
     assert(tr.stdout.indexOf("loc_mock_GetVMSSExtensionsListFailed") >= -1, "ahould warn about list failure");
     assert(tr.stdout.indexOf("loc_mock_CustomScriptExtensionInstalled") > -1, "new extension should be installed");
     assert(tr.stdout.indexOf("loc_mock_UpdatedVMSSImage") > -1, "VMSS image should be updated");
 }, tr, done);
开发者ID:Microsoft,项目名称:vsts-tasks,代码行数:10,代码来源:L0.ts

示例4: runValidations

 runValidations(() => {
     assert(tr.succeeded, "Should have succeeded");
     assert(tr.stdout.indexOf("virtualMachineExtensions.list is called") > -1, "virtualMachineExtensions.list function should have been called from azure-sdk");
     assert(tr.stdout.indexOf("virtualMachineExtensions.deleteMethod is called with resource testvmss1 and extension CustomScriptExtension1") == -1, "virtualMachineExtensions.deleteMethod function should not have been called from azure-sdk");
     assert(tr.stdout.indexOf("virtualMachineExtensions.createOrUpdate is called with resource testvmss1 and extension CustomScriptExtension") > -1, "virtualMachineExtensions.createOrUpdate function should have been called from azure-sdk");
     assert(tr.stdout.indexOf("virtualMachinesScaleSets.updateImage is called with RG: testrg1, VMSS: testvmss1 and imageurl : https://someurl") > -1, "virtualMachinesScaleSets.updateImage function should have been called from azure-sdk");
     assert(tr.stdout.indexOf("loc_mock_RemovingCustomScriptExtension") == -1, "removing old extension");
     assert(tr.stdout.indexOf("loc_mock_CustomScriptExtensionInstalled") > -1, "new extension should be installed");
     assert(tr.stdout.indexOf("loc_mock_UpdatedVMSSImage") > -1, "VMSS image should be updated");
 }, tr, done);
开发者ID:bleissem,项目名称:vsts-tasks,代码行数:10,代码来源:L0.ts

示例5: it

 it("correctly handles being instantiated with empty list of handlers", () => {
   const spy = sinon.spy();
   const stub_logger = {infoD: spy};
   const log = new middleware.ContextLogger(stub_logger, [], fake_req);
   log.info("test_title");
   const expected_context = {};
   assert(spy.calledWithExactly("test_title", expected_context));
   assert.equal(spy.callCount, 1);
 });
开发者ID:Clever,项目名称:kayvee-js,代码行数:9,代码来源:context_logger.ts

示例6: assertKVResults

    it('returns acceptable version ranges for queries', async function() {
      // Set in 3 different transactions so we get a document version range.
      const {source, version: v1} = await setSingle(this.store, 'a', 1)
      const v2 = (await setSingle(this.store, 'b', 2)).version
      const v3 = (await setSingle(this.store, 'c', 3)).version

      assert(vCmp(v1, v2) < 0 && vCmp(v2, v3) < 0)
      await assertKVResults(this.store, ['a'], [v3], [['a', 1]], sparseSV(source, this.store, {from:v1, to:v3}))
    })
开发者ID:josephg,项目名称:statecraft,代码行数:9,代码来源:common.ts

示例7: assert

 logStub = sinon.stub(consoleio, 'log').callsFake(function(string, object) {
   process.stdout.write(string + '\n')
   var expectedString = '999'
   var expectedOutput = string.indexOf(expectedString) > -1
   assert(
     expectedOutput,
     'expected logger output to contain "' + expectedString + '"'
   )
 })
开发者ID:daviddawson,项目名称:sexylog,代码行数:9,代码来源:sexylog.test.ts

示例8: it

 it('should query analytics', async () => {
   const siteUrl = 'http://jbeckwith.com';
   const path = `/webmasters/v3/sites/${
       encodeURIComponent(siteUrl)}/searchAnalytics/query`;
   const scope = nock(Utils.baseUrl).post(path).reply(200, {});
   const data = await samples.query.runSample();
   assert(data);
   scope.done();
 });
开发者ID:sheerun,项目名称:google-api-nodejs-client,代码行数:9,代码来源:test.samples.webmasters.ts

示例9: Error

 utils.parseJsonFromFile(example).then((parsedData: unknown) => {
   var valid = syntaxContext.validator.validate(parsedData, syntaxContext.exampleSchema);
 if (!valid) {
   var error = syntaxContext.validator.getLastErrors();
   throw new Error("Schema validation failed: " + util.inspect(error, { depth: null }));
 }
 assert(valid === true);
 done();
 });
开发者ID:jbuls,项目名称:azure-rest-api-specs,代码行数:9,代码来源:syntax.ts

示例10: assert

 localApis.forEach(name => {
   if (g2[name] === null) {
     // Warn if an API remains null (was not found during the discovery
     // process) to avoid failing the test.
     console.warn(name + ' was not found.');
   } else {
     assert(g2[name]);
   }
 });
开发者ID:sheerun,项目名称:google-api-nodejs-client,代码行数:9,代码来源:test.discover.ts


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