London | 26-ITP-Jan | Maryanne Mosonik | Sprint 2 | Module Data Groups#1101
London | 26-ITP-Jan | Maryanne Mosonik | Sprint 2 | Module Data Groups#1101Maryanne-K wants to merge 21 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
cjyuan
left a comment
There was a problem hiding this comment.
test.todo(" ... ") is just a placeholder to serve as a reminder for "what needs to be done".
In this exercise, that means "implementing the corresponding Jest tests described in the comments."
Can you replace them (in all .test.js files) with actual Jest tests?
|
Can you also address this comment (about implementing the Jest test in The other changes are good. |
Hey CJ, replaced all the test todo in the files. Kindly check, thank you. |
cjyuan
left a comment
There was a problem hiding this comment.
Other changes are good. I will mark this PR as complete first.
| // When passed to contains | ||
| // Then it should return false or throw an error | ||
| test("contains with invalid input returns false", () => { | ||
| expect(contains([], 'a')).toBe(false); |
There was a problem hiding this comment.
Your function is correct, but we should prepare the tests not only to verify our current implementation, but also to ensure that future changes do not alter the function's expected behavior.
This test expect(contains([], 'a')).toBe(false) cannot confirm that the function correctly returns false when the first argument is an array. This is because contains([], "a")could also returnfalse` simply because "a" is not a key of the array.
Arrays are objects, with their indices acting as keys. A proper test should use a non-empty array along with a valid key to ensure the function returns false specifically because the input is an array, not because the key is missing.
Note: Strings are not objects but their indices also act as their keys.
|
Closing PR because the January ITP run has finished. Feel free to re-open if you're still working on it. |
Self checklist
Changelist
Corrected and completed the implementations and jest test cases.