London | 26-ITP-JAN | Abdul Moiz | Sprint 1 | Data Groups#947
London | 26-ITP-JAN | Abdul Moiz | Sprint 1 | Data Groups#947A-Moiz wants to merge 7 commits intoCodeYourFuture:mainfrom
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.
Code is very solid. I only have a few suggestions.
| // Given an array with no duplicates | ||
| // When passed to the dedupe function | ||
| // Then it should return a copy of the original array |
There was a problem hiding this comment.
Can you also implement a test that checks if the function returns a copy of the original array?
There was a problem hiding this comment.
Hi, that is already one of the test cases. On line 31:
{ input: ["apple", "banana", 1, 10], expected: ["apple", "banana", 1, 10] },
If you meant something else can you explain again please? Thanks.
There was a problem hiding this comment.
This check does not check whether "the function returns a copy of the original array". It only checks if the returned value and expected have the same elements.
expect(dedupe(input)).toEqual(expected));
Sprint-1/implement/sum.test.js
Outdated
| test(`Should return the correct sum of values`, () => { | ||
| expect(sum(["apple", "banana", 1, 10])).toEqual(11); | ||
| expect(sum([1, -1, -100])).toEqual(-100); | ||
| expect(sum([-10, -20, -3, -4])).toEqual(-37); | ||
| expect(sum([1.5, 10.5, 0.5])).toBeCloseTo(12.5); | ||
| expect(sum(["apple", "banana", "cherry"])).toEqual(-Infinity); | ||
| }); |
There was a problem hiding this comment.
The description, “Should return the correct sum of values,” is quite broad. If any of the checks fail, it doesn’t clearly indicate why the function failed, making it harder for the tester to understand the specific issue.
|
Changes look good. Well done! |
Learners, PR Template
Self checklist
Changelist
Completed the exercises in each directory on Sprint 1
Questions
N/A