Skip to content

Conversation

@Fithi-Teklom
Copy link

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

@github-actions
Copy link

Your PR's title isn't in the expected format.

Please check the expected title format, and update yours to match.

Reason: Sprint part (Sprint-2) doesn't match expected format (example: 'Sprint 2', without quotes)

If this PR is not coursework, please add the NotCoursework label (and message on Slack in #cyf-curriculum or it will probably not be noticed).

If this PR needs reviewed, please add the 'Needs Review' label to this PR after you have resolved the issues listed above.

@Fithi-Teklom Fithi-Teklom changed the title Manchester| ITP-25-SEP | Fithi Teklom| Sprint-2 | Coursework Manchester| ITP-25-SEP | Fithi Teklom| Sprint 2 | Coursework Nov 30, 2025
@Fithi-Teklom Fithi-Teklom added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Dec 1, 2025
Copy link
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.

Can you improve the indentation of the code?
After installing the VSCode "prettier" extension, you can use VSCode "Format document" function to auto indent JS code.

Comment on lines 15 to 18
${recipe.ingredients[0]}:
${recipe.ingredients[1]}:
${recipe.ingredients[2]}:
${recipe.ingredients[3]}:
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you use an approach that works for any number of ingredients?

// Then it should return false or throw an error

test("contains array-like object,invalid object and null returns false",() => {
expect(contains([], "a")).toBe(false);
Copy link
Contributor

Choose a reason for hiding this comment

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

Arrays are objects in JavaScript, and they do have property names -- just not the same ones as objects.
Which keys do arrays have, and how does that affect how reliable your test is?

When testing whether the function handles arrays properly, try using a key that an array might
realistically contain
. Otherwise, you might get a passing test even if the function isn't checking for arrays at all.

Copy link
Author

Choose a reason for hiding this comment

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

okay, i get it.

Comment on lines 12 to 19
if (idx === -1) {
// No '=' found, treat entire pair as key with empty value
queryParams[pair] = "";
} else {
const key = pair.substring(0, idx);
const value = pair.substring(idx + 1);
queryParams[key] = value;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

In real query string, both key and value are percent-encoded or URL encoded.
For example,

tags%5B%5D=hello%20world -> key is tags[], value is hello world

Can your function handle URL-encoded query string?

Suggestion: Look up "How to decode a URL-encoded string in JavaScript".

throw new Error("Input must be an array");
}

const result = {};
Copy link
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.

Comment on lines +11 to +22
"abort-controller": "^3.0.0",
"array-buffer-byte-length": "^1.0.2",
"arraybuffer.prototype.slice": "^1.0.4",
"async-function": "^1.0.0",
"available-typed-arrays": "^1.0.7",
"base64-js": "^1.5.1",
"buffer": "^6.0.3",
"call-bind": "^1.0.8",
"call-bind-apply-helpers": "^1.0.2",
"call-bound": "^1.0.4",
"data-view-buffer": "^1.0.2",
"data-view-byte-length": "^1.0.2",
Copy link
Contributor

Choose a reason for hiding this comment

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

Do you need all these dependencies (specified on lines 11-111) in your exercise?!

Copy link
Author

Choose a reason for hiding this comment

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

I am not sure in which sprint of package.json you found this and where did they come from.

Copy link
Contributor

Choose a reason for hiding this comment

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

You can view all changed files in this branch through the 'Changed files' tab on this PR, and find out which package.json it is.

@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 Dec 4, 2025
@Fithi-Teklom Fithi-Teklom 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 Dec 7, 2025
@cjyuan
Copy link
Contributor

cjyuan commented Dec 7, 2025

Changes look good.

@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 Dec 7, 2025
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.

3 participants