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