You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Instructions don't say to return storeItem, but the tests fail if we don't. I think either return storeItem should be specified in the instructions in exercises.js, or the test should be changed to this:
varstoreItem={price: 80,discountPercentage: 0.1};varstoreItem2={price: 5,discountPercentage: 0.5};exercises.addCalculateDiscountPriceMethod(storeItem);exercises.addCalculateDiscountPriceMethod(storeItem2);it('should add the method \'calculateDiscountPrice\' to the store item object',function(){expect(storeItem.calculateDiscountPrice).toBeDefined();expect(storeItem2.calculateDiscountPrice).toBeDefined();});it('should return the discount price from the new \'calculateDiscountPrice\' method',function(){expect(storeItem.calculateDiscountPrice()).toBe(72);expect(storeItem2.calculateDiscountPrice()).toBe(2.5);});
Right now the tests do this, where it's using the return from our function instead of the storeItems that are in the test.js expect(exercises.addCalculateDiscountPriceMethod(storeItem).calculateDiscountPrice).toBeDefined();
The other exercises specify whether or not to return something so I think it confuses people when this one doesn't say to return something, even though it is expecting you to.
The changes to the test.js that I'm proposing have been tested and work as expected. It allows us to modify the storeItem that's passed into our function and we don't need to return it for the tests to pass.
The text was updated successfully, but these errors were encountered:
Homework 3:
addCalculateDiscountPriceMethod(storeItem)
Instructions don't say to
return storeItem
, but the tests fail if we don't. I think eitherreturn storeItem
should be specified in the instructions in exercises.js, or the test should be changed to this:Right now the tests do this, where it's using the
return
from our function instead of thestoreItem
s that are in the test.jsexpect(exercises.addCalculateDiscountPriceMethod(storeItem).calculateDiscountPrice).toBeDefined();
The other exercises specify whether or not to return something so I think it confuses people when this one doesn't say to return something, even though it is expecting you to.
The changes to the test.js that I'm proposing have been tested and work as expected. It allows us to modify the
storeItem
that's passed into our function and we don't need toreturn
it for the tests to pass.The text was updated successfully, but these errors were encountered: