Skip to content

London | 26-ITP-May | Jorvan White | Sprint 2 | Coursework - #1418

Open
JorvanW wants to merge 23 commits into
CodeYourFuture:mainfrom
JorvanW:coursework/sprint-2
Open

London | 26-ITP-May | Jorvan White | Sprint 2 | Coursework #1418
JorvanW wants to merge 23 commits into
CodeYourFuture:mainfrom
JorvanW:coursework/sprint-2

Conversation

@JorvanW

@JorvanW JorvanW commented Aug 10, 2026

Copy link
Copy Markdown

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

Created Pull Request from Sprint 2 Coursework and updated for Pull Request

@github-actions

This comment has been minimized.

@JorvanW JorvanW changed the title London | 26-ITP-May | Jorvan White | Sprint 2 - Coursework London | 26-ITP-May | Jorvan White | Sprint 2 | Coursework Aug 10, 2026
@github-actions

This comment has been minimized.

@JorvanW JorvanW added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 10, 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 Aug 10, 2026
@JorvanW JorvanW added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 10, 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 Aug 10, 2026
@JorvanW JorvanW added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 10, 2026
@Poonam-raj Poonam-raj added Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. and removed Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Aug 11, 2026
Comment thread Sprint-2/debug/recipe.js
console.log(`${recipe.title}
serves ${recipe.serves}
ingredients:
${recipe.ingredients.join("\n")}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Nice logic here

Comment thread Sprint-2/implement/lookup.test.js Outdated
Comment on lines +3 to +5
test("creates a country currency code lookup for multiple codes",() => {
expect(createLookup(countryCurrencyPairs)).toEqual([[US, 'USD'], [CA, 'CAD'], [EN, 'GBP']]);
})

@Poonam-raj Poonam-raj Aug 11, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

You could test one currency pair first, maybe something not included in this list, and then move into a bigger list. Having two tests with different inputs really helps prove that things aren't hardcoded in your solution.

Comment thread Sprint-2/implement/lookup.test.js Outdated

test.todo("creates a country currency code lookup for multiple codes");
test("creates a country currency code lookup for multiple codes",() => {
expect(createLookup(countryCurrencyPairs)).toEqual([[US, 'USD'], [CA, 'CAD'], [EN, 'GBP']]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Where is countryCurrencyPairs coming from? When I run this test it fails. Please take another look.

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 both the test file and js file. Removed unnecessary sections.

Comment thread Sprint-2/implement/querystring.js Outdated
queryParams[key] = value;


console.log(pair)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

remove logs before committing

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.

removed

Comment thread Sprint-2/implement/tally.test.js Outdated
// Then it should return an empty object
test.todo("tally on an empty array returns an empty object");
test("tally on an empty array returns an empty object",() => {
expect(tally([])).toEqual([]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Correction needed here, test asks for "return an empty object"

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

Comment thread Sprint-2/implement/tally.js Outdated
Comment on lines +1 to +20
function tally(array) { //(array) is the input to the function

if (!Array.isArray(array)){ //checking if array is actually an array
throw new Error("Input must be an array");
}

if (array.length === 0){ //if array is empty return a empty array
return []
}


const result = {} //creates result as an empty object which will store the counts


for (const item of array){ //'for' loops through every item in the array
if (result[item]){ // checks if the item is already in the result{}
result[item]++} // If it is then '++' tells it to add 1 to the value

else {
result[item] = 1; // else is saying that if it doesn't exist then we give it a value of 1

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

I generally appreciate the comments adding clarity for future ref and readers, but it's not needed and maybe makes the committed code messy. This solution is fairly easy to interpret without it and we want clean commits as much as possible

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

Comment thread Sprint-2/interpret/invert.test.js Outdated
Comment on lines +3 to +5
test("When invert is passed, keys and values in the object should be swapped ",() => {
expect({x : 10, y : 20}).toEqual({x : 10, y : 20});
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Was this test suite abandoned when you saw the questions in the js file?

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

this test suite is unfinished and not accurate to the goals of the function - see my last comment in the invert.js file

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.

fixed the function and added more test cases

Comment thread Sprint-2/interpret/invert.js Outdated


// c) What does Object.entries return? Why is it needed in this program?
// It returns an array of property into the object

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This comment is clear - please rephrase.
What specifically does the method populate the array with?
why is it useful here?

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 more context

Comment thread Sprint-2/interpret/invert.js Outdated
Comment on lines +33 to +34
// The current return value only shows {key: 2}. It doesn't show the first key and value only the second,
// and it doesn't specify the second key. Its just defined as 'key'.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Missing a part here - yes it's only catching the final key,value pair, and yes it's specifically saying 'key', but anything else wrong about the output?

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 more context

// The current return value only shows {key: 2}. It doesn't show the first key and value only the second,
// and it doesn't specify the second key. Its just defined as 'key'.

// e) Fix the implementation of invert (and write tests to prove it's fixed!)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This part is missing - your current test suite doesn't correctly test the behaviour of invert - check the example given in the top comment above again. You also haven't built the test suite up - start with a small example and build up to a bigger object. Please amend

@Poonam-raj Poonam-raj left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Some great work writing tests and implementing solutions - a few comments worth addressing, especially in the interpret section where testing is particularly lacking

@Poonam-raj Poonam-raj added Reviewed Volunteer to add when completing a review with trainee action still to take. and removed Review in progress This review is currently being reviewed. This label will be replaced by "Reviewed" soon. labels Aug 11, 2026
@JorvanW JorvanW 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants