本文整理汇总了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;未经允许,请勿转载。 |
请发表评论