Skip to content

Cape Town | 26-ITP-May| Enice Mutanda| Sprint 2| Data objects - #1419

Open
Enice-Codes wants to merge 4 commits into
CodeYourFuture:mainfrom
Enice-Codes:Data-Objects
Open

Cape Town | 26-ITP-May| Enice Mutanda| Sprint 2| Data objects#1419
Enice-Codes wants to merge 4 commits into
CodeYourFuture:mainfrom
Enice-Codes:Data-Objects

Conversation

@Enice-Codes

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

tested and passed all my code locally
modified the codes
added code to most dependent file
fix codes on certain exercises and implemented code too

@Enice-Codes Enice-Codes added Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. javascript Pull requests that update javascript code labels 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 12, 2026
Comment on lines +3 to +7
test("creates a country currency code lookup for multiple codes", () => {
const countryCurrencyPairs = [["US", "USD"], ["CA", "CAD"]];
const result = createLookup(countryCurrencyPairs);
expect(result).toEqual({ US: "USD", CA: "CAD" });
});

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 would consider having a smaller starting test for the valid input, to build the test suite up more gradually, prove the function can take different inputs and isn't hardcoded

Comment thread Sprint-2/implement/tally.test.js Outdated
Comment on lines +30 to +34
test("tally on an array with duplicate items returns counts for each unique item", () => {
expect(tally(["a"])).toEqual({ a: 1 });
expect(tally(["a", "a", "a"])).toEqual({ a: 3 });
expect(tally(["a", "a", "b", "c"])).toEqual({ a: 2, b: 1, c: 1 });
});

@Poonam-raj Poonam-raj Aug 12, 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.

Repeated test as the below - remove and replace with the test described in the comment

Comment thread Sprint-2/implement/tally.test.js Outdated
Comment on lines +40 to +45
test("tally on an array with duplicate items returns counts for each unique item", () => {
expect(tally(["a"])).toEqual({ a: 1 });
expect(tally(["a", "a", "a"])).toEqual({ a: 3 });
expect(tally(["a", "a", "b", "c"])).toEqual({ a: 2, b: 1, c: 1 });
});

@Poonam-raj Poonam-raj Aug 12, 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.

I would argue these are three different behaviours - how might you split them up in the test suite?

Comment thread Sprint-2/implement/tally.test.js Outdated
Comment on lines +50 to +54
test("tally on an array with duplicate items returns counts for each unique item", () => {
expect(tally(["a"])).toEqual({ a: 1 });
expect(tally(["a", "a", "a"])).toEqual({ a: 3 });
expect(tally(["a", "a", "b", "c"])).toEqual({ a: 2, b: 1, c: 1 });
}); No newline at end of 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.

Again a repeated test - remove and replace with valid test for the given commented behaviour

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're missing all the explanations and answers to questions a, b, c, c, d, e - please add them in

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.

hi @Poonam-raj , i answered all questions

Comment on lines +2 to +10

test("calculates the total value of a till in pounds", () => {
const till = { "1p": 10, "5p": 6, "50p": 4, "20p": 10 };
expect(totalTill(till)).toBe("£4.4");
});

test("returns £0 for an empty till", () => {
expect(totalTill({})).toBe("£0");
});

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Strong case for building up the test suite incrementally instead of one test for the final behaviour because a lot of different elements build the complexity (different denominations of money, having multiple of one money, having multiple of multiple denominations)

Comment thread Sprint-2/stretch/till.js
Comment on lines -25 to -31
// a) What is the target output when totalTill is called with the till object

// b) Why do we need to use Object.entries inside the for...of loop in this function?

// c) What does coin * quantity evaluate to inside the for...of loop?

// d) Write a test for this function to check it works and then fix the implementation of totalTill

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Please answer these questions

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.

hi @Poonam-raj, I answerd all the questions.

Comment thread Sprint-2/stretch/till.js

for (const [coin, quantity] of Object.entries(till)) {
total += coin * quantity;
const coinValue = parseInt(coin, 10);

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 use of parseInt to remove the p and convert to int

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.

Thank you Poonam

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

Missing debug elements here - can you include it in this PR?

I have a few things I'd like you to take another look at, a few answers and explanations are missing. Some tests are also wrong (tally).

Some good logic choices, and methods used.

@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 12, 2026
@Enice-Codes Enice-Codes added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 14, 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 14, 2026
@Enice-Codes Enice-Codes added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Aug 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

javascript Pull requests that update javascript code Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Reviewed Volunteer to add when completing a review with trainee action still to take.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants