Repository navigation
Conversation
…al values present
|
Just need to fix |
Comment on lines
+17
to
+27
| if (typeof list === "string") { | ||
| throw new Error("calculateMedian requires an array of numbers"); | ||
| } | ||
|
|
||
| if (typeof list === "number") { | ||
| throw new Error("calculateMedian requires an array of numbers"); | ||
| } | ||
|
|
||
| if (typeof list === "object" && !Array.isArray(list)) { | ||
| throw new Error("calculateMedian requires an array of numbers"); | ||
| } |
There was a problem hiding this comment.
In the future, you may consider combining these three conditions into one by checking if (!Array.isArray(list)).
Comment on lines
+34
to
+36
| it("given array with duplicates, returns array without duplicates", () => { | ||
| expect(dedupe([4, 6, 9, 23, 9, 23, 23])).toEqual([4, 6, 9, 23]); | ||
| }); |
There was a problem hiding this comment.
Only numbers has been tested here. How about array of strings, or array of mixed numbers and strings? Please add those tests as well. Thank you.
Comment on lines
+40
to
+49
| it("Given something that isn't array of numbers, it tells you it couldn't calculate the median and why", () => { | ||
| expect(describeMedian("banana")).toEqual( | ||
| "Could not calculate a median: calculateMedian requires an array of numbers" | ||
| ); | ||
| expect(describeMedian([3, "5", 8])).toEqual( | ||
| "Could not calculate a median: calculateMedian requires an array of numbers" | ||
| ); | ||
| expect(describeMedian(42)).toEqual( | ||
| "Could not calculate a median: calculateMedian requires an array of numbers" | ||
| ); |
There was a problem hiding this comment.
Well done. Good test cases coverage.
|
The new test cases looked good. Congratulation, you have completed this PR successfully. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Learners, PR Template
Self checklist
Task code
CYF-1071
Changelist
Completed exercises in fix, implement and refactor. Did not complete stretch.