Beispiel #1
0
    it("should validate presence of view", () => {
      const materialJSON   = TestData.p4();
      const attributesJSON = materialJSON.attributes as P4MaterialAttributesJSON;

      delete attributesJSON.view;
      const material = Material.fromJSON(materialJSON);

      expect(material.attributes().isValid()).toBe(false);
      expect(material.attributes().errors().count()).toBe(1);
      expect(material.attributes().errors().keys()).toEqual(["view"]);
    });
Beispiel #2
0
  it("should validate URL presence", () => {
    const materialJSON   = TestData.git();
    const attributesJSON = materialJSON.attributes as ScmAttributesJSON;

    delete attributesJSON.url;
    const material = Material.fromJSON(materialJSON);

    expect(material.attributes().isValid()).toBe(false);
    expect(material.attributes().errors().count()).toBe(1);
    expect(material.attributes().errors().keys()).toEqual(["url"]);
  });
Beispiel #3
0
    it("should validate presence of password", () => {
      const materialJSON   = TestData.tfs();
      const attributesJSON = materialJSON.attributes as TfsMaterialAttributesJSON;

      delete attributesJSON.password;
      const material = Material.fromJSON(materialJSON);

      expect(material.attributes().isValid()).toBe(false);
      expect(material.attributes().errors().count()).toBe(1);
      expect(material.attributes().errors().keys()).toEqual(["password"]);
    });
Beispiel #4
0
  it("should deserialize to svn material", () => {
    const materialJSON       = TestData.svn();
    const attributesJSON     = materialJSON.attributes as ScmAttributesJSON;
    const material           = Material.fromJSON(materialJSON);
    const materialAttributes = material.attributes() as ScmMaterialAttributes;

    expect(material.type()).toEqual("svn");
    expect(material.mduStartTime()).toEqual(TimeFormatter.formatInDate(materialJSON.mdu_start_time));
    expect(materialAttributes.name()).toEqual(attributesJSON.name);
    expect(materialAttributes.url()).toEqual(attributesJSON.url);
    expect(materialAttributes.autoUpdate()).toEqual(attributesJSON.auto_update);
    expect(materialAttributes.destination()).toEqual(attributesJSON.destination);
    expect(materialAttributes.filter().ignore()).toEqual(Filter.fromJSON(attributesJSON.filter).ignore());
    expect(materialAttributes.invertFilter()).toEqual(attributesJSON.invert_filter);
  });