Skip to content

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

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

bartoszkawiak wants to merge 3 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
let count = 0;
for (let i = 0; i < stringOfCharacters.length; i++) {
if (stringOfCharacters[i] === findCharacter) {
count = count + 1;

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.

Is there an alternative syntax we can use in JS to increment numbers by one?

Comment thread practice-tdd/count.js
}
return count;
}
//1st test passsed

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.

Clean up comments before committing work up

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.

Is there a smaller first test you could write for this? Have a think of what the simplest starting input could be

export function getOrdinalNumber(num) {
return "1st";
const exceptions = [11, 12, 13];
let strNum = num.toString();

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.

Could strNum be aconst variable? Would this break the code?

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.

// The goal is to re-implement that function, not to use it.
return "hellohellohello";
export function repeatStr(str, count) {
return str.repeat(count);

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 was specifically NOT meant to call the repeat method but you have done so here. Please re-design this function to not use the repeat method, design logic yourself.

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