Skip to content

London | 26-ITP-May | Rizqah Popoola | Sprint 2 | Data groups - #1323

Open
risikatpopoola wants to merge 6 commits into
CodeYourFuture:mainfrom
risikatpopoola:data-group/sprint-2
Open

London | 26-ITP-May | Rizqah Popoola | Sprint 2 | Data groups#1323
risikatpopoola wants to merge 6 commits into
CodeYourFuture:mainfrom
risikatpopoola:data-group/sprint-2

Conversation

@risikatpopoola

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

@risikatpopoola risikatpopoola added 🏕 Priority Mandatory This work is expected 📅 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. labels Jul 28, 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 Aug 1, 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.

Code is pretty solid.

Note: After our code is working correctly, its a professional practice to change all variable declarations from let to const if they are not going to be reassigned a value.

Comment thread Sprint-2/implement/contains.js Outdated
Comment thread Sprint-2/implement/contains.test.js
Comment on lines 52 to +60
// Given invalid parameters like an array
// When passed to contains
// Then it should return false or throw an error
test("returns true if the object contains the property, false otherwise", () => {
const currentOutput = contains(["a", "b", "c", "e"], "e");
const targetOutput = false;

expect(currentOutput).toEqual(targetOutput);
});

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 test does not quite match the spec given on lines 52-54.

Please note that in JS, an array is a kind of object with its indices serve as its keys.

const [key, value] = pair.split("=");
queryParams[key] = value;
if (pair === "") continue;
const [key = "", value = ""] = pair.split(/=(.*)/);

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.

Interesting approach!

Comment thread Sprint-2/implement/tally.js Outdated
Comment thread Sprint-2/implement/tally.js Outdated
@risikatpopoola risikatpopoola 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 5, 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. Just one more change needed.

Comment thread Sprint-2/implement/contains.test.js Outdated
Comment on lines 56 to 57
const currentOutput = contains(["a", "b", "c", "e"], "e");
const targetOutput = 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.

Arrays are objects, with their indices acting as keys. A proper test should use a non-empty array along with a valid key to ensure the function returns false specifically because the input is an array, not because the key is missing. "e" is not a key of the array you are testing, but "1" is.

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.

That makes sense, i wasn't checking for the key before, i have now fixed this, thank you.

@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 5, 2026
@risikatpopoola risikatpopoola 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 5, 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.

In the invalid case, you could also test other types of invalid input.

@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. labels Aug 5, 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. 🏕 Priority Mandatory This work is expected 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants