Skip to content

London | 26-ITP-May | Chinwe Chukwuma | Sprint 2 | Module-Data-Groups - #1353

Open
ChinweP wants to merge 20 commits into
CodeYourFuture:mainfrom
ChinweP:sprint-2-clean
Open

London | 26-ITP-May | Chinwe Chukwuma | Sprint 2 | Module-Data-Groups#1353
ChinweP wants to merge 20 commits into
CodeYourFuture:mainfrom
ChinweP:sprint-2-clean

Conversation

@ChinweP

@ChinweP ChinweP commented Jul 31, 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

Changelist

Sprint 2 completed

@ChinweP ChinweP added 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 31, 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 Jul 31, 2026
@github-actions

This comment has been minimized.

1 similar comment
@github-actions

This comment has been minimized.

@ChinweP ChinweP changed the title London | 26-ITP-May | Chinwe | Sprint 2 | Module-Data-Groups London | 26-ITP-May | Chinwe Chukwuma | Sprint 2 | Module-Data-Groups Jul 31, 2026
@github-actions

This comment has been minimized.

@ChinweP ChinweP added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 1, 2026
@cjyuan

cjyuan commented Aug 6, 2026

Copy link
Copy Markdown
Contributor

There is another Sprint-2 folder inside the Sprint-2 folder. I am not sure which set of files are the ones to be reviewed. Could you update this PR branch accordingly?

@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 6, 2026
@ChinweP ChinweP added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 7, 2026
@ChinweP

ChinweP commented Aug 7, 2026

Copy link
Copy Markdown
Author

@cjyuan, apologies for the inconvenience. I've removed the unnecessary Sprint-2.

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

You missed updating a few files in the implement sub-folder.

Comment thread Sprint-2/implement/contains.test.js Outdated
Comment on lines +38 to +52
// Given an object with properties
// When passed to contains with an existing property name
// Then it should return true
test("returns true when object contains the property", () => {
const obj = { a: 1, b: 2 };
expect(contains(obj, "a")).toBe(true);
});

// Given an object with properties
// When passed to contains with a non-existent property name
// Then it should return false
test("returns false when object does not contain the property", () => {
const obj = { a: 1, b: 2 };
expect(contains(obj, "c")).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.

How are these two tests different from the tests on lines 19-28?

Comment thread Sprint-2/implement/contains.test.js Outdated
// When passed to contains
// Then it should return false or throw an error
test("returns false for invalid parameters like an array", () => {
expect(contains([], "a")).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.

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.

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 removed the duplicate tests and changed the array test to use a non-empty array with a valid key.

@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 7, 2026
@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 10, 2026
@ChinweP

ChinweP commented Aug 11, 2026

Copy link
Copy Markdown
Author

I've now updated the invalid parameter test. Thanks for pointing this out.

@ChinweP ChinweP 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. and removed Reviewed Volunteer to add when completing a review with trainee action still to take. labels Aug 11, 2026
@ChinweP
ChinweP requested a review from cjyuan August 11, 2026 00:20
@cjyuan

cjyuan commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Could you also address this request?
image

Note: There are 8 files in the implement folder. You only updated two of them.

@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 11, 2026
@ChinweP

ChinweP commented Aug 13, 2026

Copy link
Copy Markdown
Author

Hi, I've now updated the remaining files in the implement folder and all tests pass.

@ChinweP ChinweP 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 13, 2026
Comment thread Sprint-2/implement/querystring.js Outdated
}

if (!pair.includes("=")) {
queryParams[pair] = "";

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.

pair could also contain percent-encoded characters.

Comment thread Sprint-2/implement/tally.js Outdated
Comment on lines +6 to +9
const counts = {};

for (const item of items) {
if (counts[item] === undefined) {

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.

Does the following function call returns the value you expect?

tally(["toString", "toString"]);

Suggestion:

  • Look up an approach to create an empty object with no inherited properties, or
  • use Object.hasOwn()

@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 13, 2026
@ChinweP

ChinweP commented Aug 13, 2026

Copy link
Copy Markdown
Author

I've addressed both comments. I updated the querystring parser to decode percent-encoded keys without values and added a test for this case. I also updated tally to use Object.hasOwn() and added a test for "toString"

@ChinweP ChinweP 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 13, 2026
@ChinweP
ChinweP requested a review from cjyuan August 13, 2026 13:50
@cjyuan

cjyuan commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

Changes look good. Well done.

@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 13, 2026
@ChinweP

ChinweP commented Aug 13, 2026

Copy link
Copy Markdown
Author

Thank you @cjyuan for your time and for reviewing my work.

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. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants