Skip to content

London | 26-ITP-Sep | Hanna Bohlin | Sprint 1 | Sprint 1 Exercises - #1486

Open
habohlin wants to merge 38 commits into
CodeYourFuture:mainfrom
habohlin:Sprint-1-Coursework
Open

habohlin wants to merge 38 commits into
CodeYourFuture:mainfrom
habohlin:Sprint-1-Coursework

Conversation

@habohlin

@habohlin habohlin commented Nov 3, 2026

Copy link
Copy Markdown

Learners, PR Template

Self checklist

  • I have titled my PR with Region | Cohort | FirstName LastName | Sprint | Assignment Title
  • My changes meet the requirements of the task
  • I have tested my changes
  • My changes follow the style guide

Task code

CYF-1071

Changelist

Completed exercises in fix, implement and refactor. Did not complete stretch.

@habohlin habohlin added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Nov 3, 2026
@hackertainment hackertainment added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 5, 2026
@hackertainment

Copy link
Copy Markdown

Just need to fix dedupe.test.js‎ and other comments are for your future reference only. You are almost there and please keep it up. Thank you.

@hackertainment hackertainment added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Nov 5, 2026
Comment thread Sprint-1/fix/median.js
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");
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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]);
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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"
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well done. Good test cases coverage.

@habohlin habohlin added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Nov 6, 2026
@hackertainment

Copy link
Copy Markdown

The new test cases looked good. Congratulation, you have completed this PR successfully.

@hackertainment hackertainment added Complete Volunteer to add when work is complete and all review comments have been addressed. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Nov 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Complete Volunteer to add when work is complete and all review comments have been addressed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants