Add tests for groceries exercise#82
Conversation
I wasn't sure where to sit on the balance of hard-coding answers vs giving potentially copyable parts of a solution in the tests... This is where I settled :)
SallyMcGrath
left a comment
There was a problem hiding this comment.
Looks great. It occurs to me that one thing you could do to minimise copying here would be to test with Set as if they just copy that back up top the test will fail as .includes is not a function on Set, but the comparison will still work the other way. IDK, might be overkill!
let allExpectedItems = new Set([...(Object.values(weeklyMealPlan))].flat());
|
Yeah, I thought quite a bit about how to write the tests; the three things I was trading off were:
I worried that using a |
ChrisOwen101
left a comment
There was a problem hiding this comment.
I feel this is an acceptable answer for the time being which will be fixed when we move to using a testing framework :)
I wasn't sure where to sit on the balance of hard-coding answers vs
giving potentially copyable parts of a solution in the tests... This is
where I settled :)
Starts to address CodeYourFuture/syllabus#230