Skip to content

London | 26-ITP-Sep | Bartosz Kawiak | Sprint 2| Practice-TDD - #1650

Open
bartoszkawiak wants to merge 5 commits into
CodeYourFuture:mainfrom
bartoszkawiak:coursework/sprint-3-practice-tdd
Open

bartoszkawiak wants to merge 5 commits into
CodeYourFuture:mainfrom
bartoszkawiak:coursework/sprint-3-practice-tdd

Conversation

@bartoszkawiak

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

Task code

CYF-1060

Changelist

Completed today’s TDD exercises using Jest. Implemented the required functions and wrote tests to cover the expected behaviour and edge cases.

@bartoszkawiak bartoszkawiak added 📅 Sprint 2 Assigned during Sprint 2 of this module Module-Structuring-And-Testing-Data The name of the module. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 5, 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 Oct 6, 2026
Comment thread practice-tdd/count.js Outdated
Comment thread practice-tdd/count.js Outdated
Comment thread practice-tdd/count.test.js
Comment thread practice-tdd/get-ordinal-number.js Outdated
Comment on lines +11 to +19
if (strNum.endsWith("1")) {
return strNum + "st";
} else if (strNum.endsWith("2")) {
return strNum + "nd";
} else if (strNum.endsWith("3")) {
return strNum + "rd";
} else {
return strNum + "th";
}

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.

Slight refactor possible here: if we are returning a value from each if statement do we need the else if or is a if statement enough?

Here I'm thinking about cleaning up the code to do the bare minimum, avoiding overengineering when it doesn't actually change the behaviour in the code.

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 the unnecessary else statement since "th" is already addressed.

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.

I get a failing test for your 'th' tests now. I believe you've just deleted a core functionality.

Please re-look at this.

My original comment was actually about the else if blocks on lines 11 - 17, not the 'th' behaviour

Image

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 misunderstood your original feedback and removed the default return statement. I've corrected this now.

Comment thread practice-tdd/repeat-str.js Outdated

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

I have a few areas I need you to iron out and the repeat-str function needs to be redesigned completely. Please look at my comments and address those changes - thank you

@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 Oct 7, 2026
@bartoszkawiak bartoszkawiak added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Oct 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 Reviewed Volunteer to add when completing a review with trainee action still to take. Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. labels Oct 12, 2026

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 function fails the screenshotted error test - take another look at the code

Image

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've added validation for negative counts so the function throws an error as expected, rather than returning an empty string.

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

thank you for your work on improving this code!

Few tests not passing at the moment, take another look at my remaining comments. Thanks :D

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

Labels

Module-Structuring-And-Testing-Data The name of the module. 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. 📅 Sprint 2 Assigned during Sprint 2 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants