Commit 06071efe authored by Mark Stenglein's avatar Mark Stenglein

Add tests to bring coverage up to 100%

Signed-off-by: Mark Stenglein's avatarMark Stenglein <mark@stengle.in>
parent b9f3f92a
Pipeline #1125 failed with stages
in 57 seconds
......@@ -29,6 +29,12 @@ describe("AltRepParam", () => {
const param: AltRepParam = new AltRepParam("valid@uri.com");
expect(param).to.exist;
});
it("should complain on empty uri", () => {
expect(() => {
const param: AltRepParam = new AltRepParam("");
}).to.throw("uri must be defined for AltRepParam");
});
});
describe("GET methods", () => {
......@@ -69,4 +75,4 @@ describe("AltRepParam", () => {
expect(result).to.equal(expected);
});
});
});
\ No newline at end of file
});
......@@ -138,6 +138,28 @@ describe("ContentLine", () => {
});
}); /** describe("fold") */
describe("set", () => {
describe("name", () => {
it("Should throw type error on non-alphabetic name", () => {
const param1: Parameter = new Parameter("P-ONE", ["value1", "value2"]);
const testLine: ContentLine = new ContentLine("name", [param1], "value");
expect(() => {
testLine.name = "$%^&*";
}).to.throw("'name' must be alphabetic!");
});
});
describe("value", () => {
it("Should throw type error on non-alphabetic name", () => {
const param1: Parameter = new Parameter("P-ONE", ["value1", "value2"]);
const testLine: ContentLine = new ContentLine("name", [param1], "value");
expect(() => {
testLine.value = "$%^&*";
}).to.throw("'value' must be alphabetic!");
});
});
});
describe("generate", () => {
it("Should respond as non-static method", () => {
expect(ContentLine).respondsTo("generate");
......
......@@ -27,5 +27,41 @@ describe("DelegatorsParam", () => {
expect(DelegatorsParam).to.exist;
});
describe("Constructor", () => {
it("Should create an object", () => {
const delegator: string = "Mark Stenglein";
const delegatorParam: DelegatorsParam = new DelegatorsParam(delegator);
expect(delegatorParam).to.exist;
});
it("Should convert string to string[]", () => {
const delegator: string = "Mark Stenglein";
const testParam: DelegatorsParam = new DelegatorsParam(delegator);
expect(testParam.delegators).to.be.deep.equal([delegator]);
});
it("Should not add extra layer to input array", () => {
const delegators: string[] = ["Mark", "Stenglein"];
const testParam: DelegatorsParam = new DelegatorsParam(delegators);
expect(testParam.delegators).to.not.deep.equal([delegators]);
expect(testParam.delegators).to.deep.equal(delegators);
});
});
describe("Setter/Getter", () => {
it("Sets paramValues as well", () => {
const delegators: string[] = ["Mark", "Stenglein"];
const testParam: DelegatorsParam = new DelegatorsParam("test");
testParam.delegators = delegators;
expect(testParam.paramValues).to.exist;
});
it("Sets paramValues correctly", () => {
const delegators: string[] = ["Mark", "Stenglein"];
const testParam: DelegatorsParam = new DelegatorsParam("test");
testParam.delegators = delegators;
expect(testParam.paramValues).to.be.deep.equal(delegators);
});
});
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment