Im not getting partial tests to pass: OOP mixins challenge

https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/object-oriented-programming/use-a-mixin-to-add-common-behavior-between-unrelated-objects

let bird = {
  name: "Donald",
  numLegs: 2
};

let boat = {
  name: "Warrior",
  type: "race-boat"
};

// Add your code below this line

let glideMixin = function(obj){
obj.glide = function() {
  console.log("Gliding strong along the horizon!");
}
};
glideMixin(bird);
//glideMixin(boat);
bird.glide();
boat.glide();

I was hoping that 1 or 2/3 test cases would pass, with the commented out code, but 0/3 passes, after i uncomment the code all 3 test cases pass

@tommygebru It has to do with the way the tests are ran against the code in the editor. Since you attempt to call boat.glide() in the code, that errors out before the test has a chance to execute fully, which ends up causing all the tests to fail. If you comment out that last line, you will see that two out of the three tests pass.

1 Like