diff --git a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.english.md b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.english.md index b480145038..f2e5b8344b 100644 --- a/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.english.md +++ b/curriculum/challenges/english/02-javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object.english.md @@ -58,6 +58,12 @@ tests: testString: assert(code.match(/class/g)); - text: Thermostat should be able to be instantiated. testString: assert((() => {const t = new Thermostat(32);return typeof t === 'object' && t.temperature === 0;})()); + - text: A getter should be defined. + testString: assert((() => {const desc = Object.getOwnPropertyDescriptor(Thermostat.prototype, 'temperature');return !!desc && typeof desc.get === 'function';})()); + - text: A setter should be defined. + testString: assert((() => {const desc = Object.getOwnPropertyDescriptor(Thermostat.prototype, 'temperature');return !!desc && typeof desc.set === 'function';})()); + - text: Calling the setter should set the temperature. + testString: assert((() => {const t = new Thermostat(32); t.temperature = 26;return t.temperature !== 0;})()); ```