ES6 exercise tests lack accuracy

Tell us what’s happening:

Tests are giving me the OK even though I have not set neither the getter or setter part of the exercise. By just defining the class and constructor alone the challenge is completed. Maybe add 2 more tests to make sure getter and setter are used?

Your code so far


function makeClass() {
  "use strict";
  /* Alter code below this line */
  class Thermostat {
    constructor() {
      // see? no setter nor getter here... hmm
    }
  }
  /* Alter code above this line */
  return Thermostat;
}
const Thermostat = makeClass();
const thermos = new Thermostat(76); // setting in Fahrenheit scale
let temp = thermos.temperature; // 24.44 in C
thermos.temperature = 26;
temp = thermos.temperature; // 26 in C

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36.

Link to the challenge:
https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/es6/use-getters-and-setters-to-control-access-to-an-object/

Thank you for helping make FCC better. Bugs should always be reported as GitHub Issues. Whenever reporting a bug, please check first that there isn’t already an issue for it and provide as much detail as possible.

1 Like

Thanks! didn’t know how to report this. Now I do =P

And surely enough, there’s an existing Issue open for this:

If you’re feeling ambitious you can try to fix it. :smiley: FCC has made contributing to the curriculum much easier.

1 Like