Skip to content

London | 26-ITP-May | Zadri Abdule | Sprint 3 | Practice tdd#1370

Open
Zadri415 wants to merge 7 commits into
CodeYourFuture:mainfrom
Zadri415:sprint-3/practice-tdd
Open

London | 26-ITP-May | Zadri Abdule | Sprint 3 | Practice tdd#1370
Zadri415 wants to merge 7 commits into
CodeYourFuture:mainfrom
Zadri415:sprint-3/practice-tdd

Conversation

@Zadri415

@Zadri415 Zadri415 commented Jun 21, 2026

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

Changelist

Implemented & added Jest tests for Sprint-3 practice TDD.

@github-actions

This comment has been minimized.

@Zadri415 Zadri415 added 📅 Sprint 3 Assigned during Sprint 3 of this module Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. Module-Structuring-And-Testing-Data The name of the module. labels Jun 21, 2026

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

Code looks good. I just have some suggestions.

Comment on lines +7 to +10
* - The function is case-sensitive: 'a' ≠ 'A'.
* - `stringOfCharacters` may be `null` or `undefined`; in that case the function returns 0.
* - `findCharacter` is treated as a single character (a single Unicode code point).
* If you pass a longer string it will never match.

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.

If these behaviors are expected from the function, then in TDD we should prepare tests to ensure the function meet all these requirements, including

  • A test to show the function is case-sensitive: 'a' ≠ 'A'.
  • A test to show that the function will return 0 if the 2nd parameter is a string containing more than one character

Comment on lines +3 to +5
if (typeof num !== "number" || Number.isNaN(num)) {
throw new TypeError("Input must be a number");
}

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.

Note: A stricter check would be to ensure num is an integer.

I don't think ordinal numbers apply to non-integers.

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.

Thanks for feedback.

@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 Jun 27, 2026
@cjyuan

cjyuan commented Jun 27, 2026

Copy link
Copy Markdown
Contributor

On separate note, the PR description is missing a "Checklist" heading (a level 2 heading)

Zadri415 added 4 commits June 27, 2026 16:38
Added validation to ensure input is an integer.
Updated test cases to ensure non-integer inputs throw errors instead of returning ordinal strings.
@Zadri415 Zadri415 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 30, 2026
@cjyuan

cjyuan commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Changes look good. Well done.

@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. Reviewed Volunteer to add when completing a review with trainee action still to take. labels Jun 30, 2026
@Zadri415 Zadri415 added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jun 30, 2026
@cjyuan cjyuan removed the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Jul 1, 2026
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. Module-Structuring-And-Testing-Data The name of the module. 📅 Sprint 3 Assigned during Sprint 3 of this module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants