Skip to content

London | 26-ITP-Jan | Maryanne Mosonik | Sprint 3 | Practice-TDD#1069

Open
Maryanne-K wants to merge 10 commits intoCodeYourFuture:mainfrom
Maryanne-K:coursework/practice-tdd
Open

London | 26-ITP-Jan | Maryanne Mosonik | Sprint 3 | Practice-TDD#1069
Maryanne-K wants to merge 10 commits intoCodeYourFuture:mainfrom
Maryanne-K:coursework/practice-tdd

Conversation

@Maryanne-K
Copy link

  • 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

This PR contains the Practise-TDD section of Sprint 3.

I agree to follow the code of conduct for this organisation.

@Maryanne-K Maryanne-K added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Feb 25, 2026
Comment on lines +45 to +49
test("should throw an error when count is negative", () => {
const str = "hello";
const count = -1;
expect(() => repeatStr(str, count)).toThrow("Count must be a non-negative integer");
});
Copy link
Contributor

Choose a reason for hiding this comment

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

Can your implementation pass this test?

Copy link
Author

@Maryanne-K Maryanne-K Mar 6, 2026

Choose a reason for hiding this comment

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

Yes it would because it is specifically checking for a negative count, which is an error.

@cjyuan Kindly check implemented corrections. Thank you for your help.

Copy link
Contributor

Choose a reason for hiding this comment

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

Did you run the test script to find out if your function can pass the test or if the test is prepared correctly?

Copy link
Author

Choose a reason for hiding this comment

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

Apologies, just checked, it fails, forgot to add the word integer as the expected substring and received messages were different.

@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 Mar 6, 2026
@cjyuan
Copy link
Contributor

cjyuan commented Mar 6, 2026

repeat-str.js or repeat-str.test.js still have an issue to be addressed. Other changes look good.

You should also add the "Needs Review" label when the PR is ready to be re-reviewed.

@Maryanne-K Maryanne-K added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 6, 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 Mar 6, 2026
@cjyuan
Copy link
Contributor

cjyuan commented Mar 6, 2026

Changes to the code look good.

But your last commit also committed a change to package.json -- a file that the Validation bot does not expect (because it is not a file inside the Sprint-3/2-practice-tdd folder).

Can you revert (undo) the change to package.json? (Otherwise the bot will not allow you to use "Needs Review" label)


One way to revert changes to a file is via the git restore command.

First, locate a commit before the file was modified. It could be the first commit you made, assuming the branch started in a clean state.

Next, record the first 7 characters of the commit SHA.

Suppose the file is path/to/file, and you want to restore the file to its state before the commit with SHA 1234567.
The command is:

git restore --source=1234567^ path/to/file

After the file is restored, make a commit and push the changes to GitHub.

@Maryanne-K Maryanne-K force-pushed the coursework/practice-tdd branch from ea18c85 to 6a8425e Compare March 6, 2026 23:03
@Maryanne-K Maryanne-K added the Needs Review Trainee to add when requesting review. PRs without this label will not be reviewed. label Mar 6, 2026
@Maryanne-K
Copy link
Author

Changes to the code look good.

But your last commit also committed a change to package.json -- a file that the Validation bot does not expect (because it is not a file inside the Sprint-3/2-practice-tdd folder).

Can you revert (undo) the change to package.json? (Otherwise the bot will not allow you to use "Needs Review" label)

One way to revert changes to a file is via the git restore command.

First, locate a commit before the file was modified. It could be the first commit you made, assuming the branch started in a clean state.

Next, record the first 7 characters of the commit SHA.

Suppose the file is path/to/file, and you want to restore the file to its state before the commit with SHA 1234567. The command is:

git restore --source=1234567^ path/to/file

After the file is restored, make a commit and push the changes to GitHub.

Just saw this, thank you CJ. I deleted my last commit, force pushed and made the changes again.

@cjyuan
Copy link
Contributor

cjyuan commented Mar 6, 2026

All good now! 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 Mar 6, 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants