London|ITP-Jan-2026| Ping Wang | Sprint 3 | 2-Practice TDD#1009
London|ITP-Jan-2026| Ping Wang | Sprint 3 | 2-Practice TDD#1009pathywang wants to merge 7 commits intoCodeYourFuture:mainfrom
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Let's keep the file tidy without console logs unless it's the aim of the exercise.
There was a problem hiding this comment.
Let's keep the file tidy without console logs unless it's the aim of the exercise.
| lastDigit = num % 10; | ||
| lastTwoDigits = num % 100; |
There was a problem hiding this comment.
While this, in theory, works, without a declaration keyword, they become implicit global variables, which could cause bugs. How can we fix that?
There was a problem hiding this comment.
Let's keep the file tidy without console logs unless it's the aim of the exercise.
| // When the repeatStr function is called with these inputs, | ||
| // Then it should throw an error, as negative counts are not valid. | ||
| test("should repeat the string negative times", () => { | ||
| expect(repeatStr("celebration", -5)).toEqual("invalid count"); |
There was a problem hiding this comment.
Throwing an error and returning a string is quite different, how can we fix this test?
| function repeatStr(str,count) { | ||
| if (count>0) return str.repeat(count) | ||
| if (count===0) return "" | ||
| if (count<0) return"invalid count" |
There was a problem hiding this comment.
The test is asking for an error to be thrown when the count is negative but we are instead returning a string, how can we address that?
| return "hellohellohello"; | ||
| function repeatStr(str,count) { | ||
| if (count>0) return str.repeat(count) | ||
| if (count===0) return "" |
There was a problem hiding this comment.
What would happen if we were to call str.repeat(0) ? Give it a shot, and once you do, how can we tweak this function slightly to save ourselves from one more if statement?
|
Sorry, Harry.there is some problem with this branch because there is
diverge from main branch. i made this mistake two weeks ago then mess all
my branch. even one volunteer from yesterday did fix it. but today after i
did some correction, i can not commit push due to sync changes which i do
not know how to do it. I think it is better i just create new branch which
is sprint-3/-2, do you mind reviewing my new branch? i ament everything you
require.
sorry for the inconvenience cause
kind regards
ping
…On Sun, 1 Mar 2026 at 16:57, Harry (Charalampos) Kavalikas < ***@***.***> wrote:
***@***.**** requested changes on this pull request.
------------------------------
On Sprint-3/2-practice-tdd/count.js
<#1009 (comment)>
:
Let's keep the file tidy without console logs unless it's the aim of the
exercise.
------------------------------
On Sprint-3/2-practice-tdd/get-ordinal-number.js
<#1009 (comment)>
:
Let's keep the file tidy without console logs unless it's the aim of the
exercise.
------------------------------
In Sprint-3/2-practice-tdd/get-ordinal-number.js
<#1009 (comment)>
:
> + lastDigit = num % 10;
+ lastTwoDigits = num % 100;
While this, in theory, works, without a declaration keyword, they become
implicit global variables, which could cause bugs. How can we fix that?
------------------------------
On Sprint-3/2-practice-tdd/repeat-str.js
<#1009 (comment)>
:
Let's keep the file tidy without console logs unless it's the aim of the
exercise.
------------------------------
In Sprint-3/2-practice-tdd/repeat-str.test.js
<#1009 (comment)>
:
>
// Case: Handle negative count:
// Given a target string `str` and a negative integer `count`,
// When the repeatStr function is called with these inputs,
// Then it should throw an error, as negative counts are not valid.
+test("should repeat the string negative times", () => {
+ expect(repeatStr("celebration", -5)).toEqual("invalid count");
Throwing an error and returning a string is quite different, how can we
fix this test?
------------------------------
In Sprint-3/2-practice-tdd/repeat-str.js
<#1009 (comment)>
:
> @@ -1,5 +1,11 @@
-function repeatStr() {
- return "hellohellohello";
+function repeatStr(str,count) {
+ if (count>0) return str.repeat(count)
+ if (count===0) return ""
+ if (count<0) return"invalid count"
The test is asking for an error to be thrown when the count is negative
but we are instead returning a string, how can we address that?
------------------------------
In Sprint-3/2-practice-tdd/repeat-str.js
<#1009 (comment)>
:
> @@ -1,5 +1,11 @@
-function repeatStr() {
- return "hellohellohello";
+function repeatStr(str,count) {
+ if (count>0) return str.repeat(count)
+ if (count===0) return ""
What would happen if we were to call str.repeat(0) ? Give it a shot, and
once you do, how can we tweak this function slightly to save ourselves from
one more if statement?
—
Reply to this email directly, view it on GitHub
<#1009 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BR4KUR2LYHBK7IBAGPP3M6T4ORTXHAVCNFSM6AAAAACV3LFWJOVHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZTQNZSG4ZTIMZSGI>
.
You are receiving this because you authored the thread.Message ID:
<CodeYourFuture/Module-Structuring-and-Testing-Data/pull/1009/review/3872734322
@github.com>
|
|
Absolutely @pathywang , feel free to close this PR, open a new one and assign me as a reviewer. |
|
Hi, Harry thank you very much. i have not closed 1109 but i have already
open new one 1120. i dd put needs review but i do not know how to assign
you as a reviewer? can you tell me how to do it? this is my new one
London|ITP-Jan-2026|Ping Wang|Sprint 3|2-practice-tdd#1120
Open
pathywang <https://github.com/pathywang> wants to merge 5 commits into
CodeYourFuture:main
<https://github.com/CodeYourFuture/Module-Structuring-and-Testing-Data/tree/main>from
kind regards
ping
…On Mon, 2 Mar 2026 at 07:01, Harry (Charalampos) Kavalikas < ***@***.***> wrote:
*hkavalikas* left a comment
(CodeYourFuture/Module-Structuring-and-Testing-Data#1009)
<#1009 (comment)>
Absolutely @pathywang <https://github.com/pathywang> , feel free to close
this PR, open a new one and assign me as a reviewer.
—
Reply to this email directly, view it on GitHub
<#1009 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BR4KUR2CQ7OV7DCEEXELRP34OUWTBAVCNFSM6AAAAACV3LFWJOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTSOBSGUZDGNBXHA>
.
You are receiving this because you were mentioned.Message ID:
<CodeYourFuture/Module-Structuring-and-Testing-Data/pull/1009/c3982523478@
github.com>
|
|
Hey @pathywang , amazing work. I approved the other PR with one small comment; let's close this one as it's a duplicate. Re; assigning someone as a reviewer, assuming you have the necessary permissions, you can use the Reviewers component at the top right and select someone by name. Having said that, I wouldn't worry too much if you can't use it, as it's definitely out of scope for this exercise. Once again, amazing work!
|
|
Thank you Harry. I have closed the previous PR. Once again, do appreciate
your hard work at Monday early morning!
kind regards
ping
…On Mon, 2 Mar 2026 at 07:59, Harry (Charalampos) Kavalikas < ***@***.***> wrote:
*hkavalikas* left a comment
(CodeYourFuture/Module-Structuring-and-Testing-Data#1009)
<#1009 (comment)>
Hey @pathywang <https://github.com/pathywang> , amazing work. I approved
the other PR with one small comment; let's close this one as it's a
duplicate.
Re; assigning someone as a reviewer, assuming you have the necessary
permissions, you can use the Reviewers component at the top right and
select someone by name. Having said that, I wouldn't worry too much if you
can't use it, as it's definitely out of scope for this exercise. Once
again, amazing work!
Screen.Shot.2026-03-02.at.07.55.58.am.png (view on web)
<https://github.com/user-attachments/assets/1d077adb-a8c5-437e-9b94-198cb470b51b>
—
Reply to this email directly, view it on GitHub
<#1009 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/BR4KURYVE4MR24Q3ELP6JI34OU5NDAVCNFSM6AAAAACV3LFWJOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZTSOBSG42DSMJXGA>
.
You are receiving this because you were mentioned.Message ID:
<CodeYourFuture/Module-Structuring-and-Testing-Data/pull/1009/c3982749170@
github.com>
|

Changelist
After i redo my prep and create file for test.js and test.jest.je to check i did everything OK, i completed 6 tests and jest tests ok.
Questions
none