Skip to content

London | 26-ITP-May | Anita Amirhaeri | Sprint 2 | Module-data-group - #1390

Open
anitahy73 wants to merge 19 commits into
CodeYourFuture:mainfrom
anitahy73:sprint2
Open

London | 26-ITP-May | Anita Amirhaeri | Sprint 2 | Module-data-group#1390
anitahy73 wants to merge 19 commits into
CodeYourFuture:mainfrom
anitahy73:sprint2

Conversation

@anitahy73

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

Sprint 2 | Module-data-group

Questions

@anitahy73 anitahy73 added 📅 Sprint 2 Assigned during Sprint 2 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Data-Groups The name of the module. and removed Module-Data-Groups The name of the module. labels Aug 6, 2026
Comment thread Sprint-2/implement/contains.js Outdated
Comment thread Sprint-2/implement/tally.js
@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 Aug 10, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@cjyuan

cjyuan commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

You might have accidently "saved" readme.md and modified it. Could you address the validation bot complaint by reverting the change made to that file?

@anitahy73 anitahy73 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 Aug 14, 2026

@cjyuan cjyuan left a comment

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.

Changes look good.

Could you also update contains.test.js and lookup.test.js, and tally.test.js?

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 14, 2026
@cjyuan cjyuan added the Reviewed Volunteer to add when completing a review with trainee action still to take. label Aug 14, 2026
Added tests for the 'contains' function to validate behavior with various inputs, including empty objects, existing properties, non-existent properties, and invalid inputs.
Added input validation for countryCurrencyPairs and improved error handling.
Added tests for createLookup function to verify correct handling of valid pairs, empty input, and malformed pairs.
@anitahy73 anitahy73 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 Aug 15, 2026
Comment on lines +35 to +36
expect(tally(["a"])).toEqual({ a: 1 });
expect(tally(["a", "a", "a"]).a).toBe(3);

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.

Could you research the trade-off between the first and the 2nd approaches to check if the function counts duplicates correctly?

});

test("invalid inputs (arrays, null, non-objects) return false", () => {
expect(contains([], "0")).toBe(false);

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.

Array in JS is also an object, but "0" is not a key of [].

A function that fails to check if the first argument is an array could also return false simply because "0" is not a key of an empty array. To properly test if the function could return false when the first argument is an array, we should use a non-empty array, and then specify a key which the array has as the 2nd argument.

@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 Aug 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Module-Data-Groups The name of the module. Reviewed Volunteer to add when completing a review with trainee action still to take. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants