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


TypeScript types.Material類代碼示例

本文整理匯總了TypeScript中models/materials/types.Material的典型用法代碼示例。如果您正苦於以下問題:TypeScript Material類的具體用法?TypeScript Material怎麽用?TypeScript Material使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


在下文中一共展示了Material類的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: assertInvalidPaths

 function assertInvalidPaths(material: Material, attrs: ScmMaterialAttributes, paths: string[]) {
   for (const path of paths) {
     attrs.destination(path);
     expect(material.isValid()).toBe(false, `${path} should be invalid`);
     expect(attrs.errors().hasErrors("destination")).toBe(true, `${path} should yield errors`);
     expect(attrs.errors().errorsForDisplay("destination")).toBe("Must be a relative path within the pipeline's working directory.");
   }
 }
開發者ID:,項目名稱:,代碼行數:8,代碼來源:

示例2: it

    it("should validate name if provided", () => {
      const material = new Material("git", new GitMaterialAttributes(undefined, true, "http://host"));
      expect(material.isValid()).toBe(true);

      material.attributes().name("foo bar baz");
      expect(material.name()).toBe("foo bar baz");

      expect(material.isValid()).toBe(false);
      expect(material.attributes().errors().count()).toBe(1);
      expect(material.attributes().errors().keys()).toEqual(["name"]);
      expect(material.attributes().errors().errorsForDisplay("name")).toBe("Invalid name. This must be alphanumeric and can contain hyphens, underscores and periods (however, it cannot start with a period). The maximum allowed length is 255 characters.");
    });
開發者ID:,項目名稱:,代碼行數:12,代碼來源:

示例3: it

 it("should should validate P4 material attributes", () => {
   const material = new Material("git", new P4MaterialAttributes());
   expect(material.isValid()).toBe(false);
   expect(material.errors().count()).toBe(0);
   expect(material.errors().count()).toBe(0);
   expect(material.attributes().errors().count()).toBe(2);
   expect(material.attributes().errors().keys()).toEqual(["view", "port"]);
   expect(material.attributes().errors().errorsForDisplay("port"))
     .toEqual("Host and port must be present.");
 });
開發者ID:GaneshSPatil,項目名稱:gocd,代碼行數:10,代碼來源:types_spec.ts


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