Skip to content

Commit

Permalink
user can reset temperature to 20 degrees with reset() fn
Browse files Browse the repository at this point in the history
  • Loading branch information
kierepkak committed Aug 21, 2019
1 parent dae55c2 commit 4cdffac
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions spec/ThermostatSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,8 @@ describe("Thermostat", function() {
it("has an power mode on as a default", () => {
expect(thermostat.savingMode).toBeTruthy();
});
it("can reset temperature to 20 degrees with reset function", () => {
thermostat.reset();
expect(thermostat.temperature()).toEqual(20);
});
});
3 changes: 3 additions & 0 deletions src/Thermostat.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,6 @@ Thermostat.prototype.down = function(number) {
}
this._temperature -= number;
};
Thermostat.prototype.reset = function() {
this._temperature = 20;
};

0 comments on commit 4cdffac

Please sign in to comment.