Skip to content

Manchester | 26-ITP-Jan | Liban Jama | Sprint 1 | Data Groups #1016

Open
libanj0161 wants to merge 15 commits intoCodeYourFuture:mainfrom
libanj0161:Module-Data-Groups-fix
Open

Manchester | 26-ITP-Jan | Liban Jama | Sprint 1 | Data Groups #1016
libanj0161 wants to merge 15 commits intoCodeYourFuture:mainfrom
libanj0161:Module-Data-Groups-fix

Conversation

@libanj0161
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

Changelist

Completed Fix under data groups module.

Questions

N/A.

@libanj0161 libanj0161 added 📅 Sprint 1 Assigned during Sprint 1 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 16, 2026
@libanj0161 libanj0161 added the Module-Data-Groups The name of the module. label Mar 16, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 16, 2026
@libanj0161 libanj0161 changed the title Manchester | 26-ITP-Jan | Liban Jama | Sprint 1 | Module-data-Groups Fix Manchester | 26-ITP-Jan | Liban Jama | Sprint 1 | Data Groups Fix Mar 16, 2026
@github-actions

This comment has been minimized.

@libanj0161 libanj0161 changed the title Manchester | 26-ITP-Jan | Liban Jama | Sprint 1 | Data Groups Fix Manchester | 26-ITP-Jan | Liban Jama | Sprint 1 | Data Groups Mar 16, 2026
@github-actions

This comment has been minimized.

@libanj0161 libanj0161 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 16, 2026
@github-actions

This comment has been minimized.

@github-actions github-actions bot removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 16, 2026
@github-actions

This comment has been minimized.

@libanj0161 libanj0161 added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. and removed 📅 Sprint 1 Assigned during Sprint 1 of this module labels Mar 16, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@github-actions github-actions bot removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 16, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@libanj0161 libanj0161 added 📅 Sprint 1 Assigned during Sprint 1 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 16, 2026
@libanj0161 libanj0161 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 16, 2026
@cjyuan cjyuan added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Mar 19, 2026
@libanj0161 libanj0161 requested a review from cjyuan March 28, 2026 00:06
@libanj0161 libanj0161 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 28, 2026
Comment on lines +74 to +81
test("given an array including Nan return correct total", () => {
expect(findMax([11, NaN, 5])).toBe(11);
});

// Given an array with numeric string value
// When passed to the max function
// Then it should ignore the numeric string and return correct total
test("given an array with numeric string value, it should ignore the numeric string and return correct total", () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The description of the expected return value are not quite correct.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Updated test description

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 28, 2026
@libanj0161 libanj0161 requested a review from cjyuan March 28, 2026 09:11
@libanj0161 libanj0161 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 28, 2026
Comment on lines +27 to +31
const input = ["a", "b", "c"];
const result = dedupe(input);

expect(result).toEqual(input);
expect(result).not.toBe(input);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There is a chance that, even though result has incorrect elements (for example, []),
the two tests could still pass. Can you figure out why, and then fix the tests accordingly?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Added .toHaveLength to ensure the returned array has the same number of elements as the original.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is better but it is still not 100% bullet proof. What if result is ["a", "b", "x"]?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can you update the test to ensure expected has the expected elements?
And optionally add another test to ensure input remains unchanged after the function call.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

From my research .toEqual already ensures the returned array has the exact expected elements. I also added an additional test to verify that calling the function does not change the original array.

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 28, 2026
@libanj0161 libanj0161 requested a review from cjyuan March 28, 2026 09:27
@libanj0161 libanj0161 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 28, 2026
@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 28, 2026
@libanj0161 libanj0161 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 28, 2026
Copy link
Copy Markdown
Contributor

@cjyuan cjyuan left a comment

Choose a reason for hiding this comment

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

Changes look good.


dedupe(input);

expect(input).toEqual(original);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

You could combine this with the previous test.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I have now, thanks

@cjyuan cjyuan 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. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Mar 28, 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. Module-Data-Groups The name of the module.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants