Commit 6d80477a authored by Mark Stenglein's avatar Mark Stenglein
Browse files

All tests written to current development point

- Onward to greater page numbers in the RFC!
parent 6b029687
Pipeline #929 passed with stage
in 16 seconds
...@@ -106,17 +106,41 @@ describe("Parameter", () => { ...@@ -106,17 +106,41 @@ describe("Parameter", () => {
}); });
}); });
describe("***paramValues", () => { describe("paramValues", () => {
it("Correctly sets paramtext values", () => { it("Correctly sets paramtext values", () => {
const name: string = "TEST";
const values: string[] = ["value", "value2"];
const param: Parameter = new Parameter(name, values);
const result: string[] = param.paramValues;
expect(result).to.deep.equal(values);
}); });
it("Correctly sets quoted-string values", () => { it("Correctly sets quoted-string values", () => {
const name: string = "TEST";
const values: string[] = ["\"value\"", "\"value2\""];
const param: Parameter = new Parameter(name, values);
const result: string[] = param.paramValues;
expect(result).to.deep.equal(values);
}); });
it("Throws an exception on malformed string", () => { it("Correctly sets mixed type values", () => {
const name: string = "TEST";
const values: string[] = ["value", "\"value2\""];
const param: Parameter = new Parameter(name, values);
const result: string[] = param.paramValues;
expect(result).to.deep.equal(values);
});
it("Throws an exception on malformed string", () => {
expect(() => {
const name: string = "TEST";
const values: string[] = ["V#\"!UE"];
const param: Parameter = new Parameter(name, values);
}).to.throw("param-value must either be valid paramtext or" +
" quoted-string");
}); });
}); });
}); });
...@@ -136,15 +160,28 @@ describe("Parameter", () => { ...@@ -136,15 +160,28 @@ describe("Parameter", () => {
*/ */
describe("***generate()", () => { describe("***generate()", () => {
it("Correctly generates single-valued parameters", () => { it("Correctly generates single-valued parameters", () => {
const param: Parameter = new Parameter("NAME", ["value1"]);
const result: string = param.generate();
const expected: string = "NAME=value1";
expect(result).to.be.equal(expected);
}); });
it("Correctly generates double-valued parameters", () => { it("Correctly generates double-valued parameters", () => {
const param: Parameter = new Parameter("NAME", ["value1", "value2"]);
const result: string = param.generate();
const expected: string = "NAME=value1,value2";
expect(result).to.be.equal(expected);
}); });
it("Correctly generates multi-valued parameters", () => { it("Correctly generates multi-valued parameters", () => {
const param: Parameter = new Parameter("NAME", [
"value1", "value2", "value3"]);
const result: string = param.generate();
const expected: string = "NAME=value1,value2,value3";
expect(result).to.be.equal(expected);
}); });
}); });
......
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