Skip to content
This repository has been archived by the owner on Jun 3, 2022. It is now read-only.

Commit

Permalink
Adds clone tests and updates dataType tests for variables. Closes #55. (
Browse files Browse the repository at this point in the history
  • Loading branch information
chriscox authored Jan 9, 2017
1 parent 83e326d commit 8949d8d
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/core/__tests__/BooleanVariable_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,9 @@ describe("BooleanVariable", () => {
expect(callbackSpy).to.have.been.calledOnce.and.calledWith(variable);
expect(updatedVariable.selectedValue).to.equal(newValue);
});

it("should clone properly", () => {
let clone = variable.clone();
expect(JSON.stringify(clone)).to.equal(JSON.stringify(variable));
});
});
8 changes: 8 additions & 0 deletions src/core/__tests__/ColorVariable_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ describe("ColorVariable", () => {

it("have the correct contraintType", () => {
expect(variable.constraintType).to.equal(ConstraintType.LIST);

variable.possibleValues = [];
expect(variable.constraintType).to.equal(ConstraintType.NONE);
});

it("have the correct controlType", () => {
Expand Down Expand Up @@ -73,4 +76,9 @@ describe("ColorVariable", () => {
expect(callbackSpy).to.have.been.calledOnce.and.calledWith(variable);
expect(updatedVariable.selectedValue).to.equal(newValue);
});

it("should clone properly", () => {
let clone = variable.clone();
expect(JSON.stringify(clone)).to.equal(JSON.stringify(variable));
});
});
8 changes: 8 additions & 0 deletions src/core/__tests__/NumberVariable_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ describe("NumberVariable", () => {

it("have the correct contraintType", () => {
expect(variable.constraintType).to.equal(ConstraintType.LIST);

variable.possibleValues = [];
expect(variable.constraintType).to.equal(ConstraintType.NONE);
});

it("should have correct controlType based on number of allowed values", () => {
Expand Down Expand Up @@ -73,4 +76,9 @@ describe("NumberVariable", () => {
expect(callbackSpy).to.have.been.calledOnce.and.calledWith(variable);
expect(updatedVariable.selectedValue).to.equal(newValue);
});

it("should clone properly", () => {
let clone = variable.clone();
expect(JSON.stringify(clone)).to.equal(JSON.stringify(variable));
});
});
5 changes: 5 additions & 0 deletions src/core/__tests__/RangeVariable_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,9 @@ describe("RangeVariable", () => {
expect(callbackSpy).to.have.been.calledOnce.and.calledWith(variable);
expect(updatedVariable.selectedValue).to.equal(newValue);
});

it("should clone properly", () => {
let clone = variable.clone();
expect(JSON.stringify(clone)).to.equal(JSON.stringify(variable));
});
});
8 changes: 8 additions & 0 deletions src/core/__tests__/StringVariable_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@ describe("StringVariable", () => {

it("have the correct contraintType", () => {
expect(variable.constraintType).to.equal(ConstraintType.LIST);

variable.possibleValues = [];
expect(variable.constraintType).to.equal(ConstraintType.NONE);
});

it("should have correct controlType based on number of allowed values", () => {
Expand Down Expand Up @@ -73,4 +76,9 @@ describe("StringVariable", () => {
expect(callbackSpy).to.have.been.calledOnce.and.calledWith(variable);
expect(updatedVariable.selectedValue).to.equal(newValue);
});

it("should clone properly", () => {
let clone = variable.clone();
expect(JSON.stringify(clone)).to.equal(JSON.stringify(variable));
});
});

0 comments on commit 8949d8d

Please sign in to comment.