@@ -8,15 +8,31 @@ function repeatStr(n, str) {
88
99module . exports = repeatStr ;
1010// const repeatStr = require("./repeat-str");
11-
11+ // Given a target string `str` and a positive integer `count`,
12+ // When the repeatStr function is called with these inputs,
13+ // Then it should:
1214// test("repeats a string n times", () => {
1315// expect(repeatStr(3, "hello")).toBe("hellohellohello");
1416// });
15-
17+ const repeatStr = require ( "./repeat-str" ) ;
18+ test ( "repeats a string n times" , ( ) => {
19+ expect ( repeatStr ( 3 , "hello" ) ) . toBe ( "hellohellohello" ) ;
20+ } ) ;
1621// test("repeats a different string", () => {
1722// expect(repeatStr(2, "abc")).toBe("abcabc");
1823// });
19-
24+ test ( "repeats a different string" , ( ) => {
25+ expect ( repeatStr ( 2 , "abc" ) ) . toBe ( "abcabc" ) ;
26+ } ) ;
27+ // test("returns empty string when n is 0", () => {
28+ // expect(repeatStr(0, "hi")).toBe("");
29+ // });
30+ test ( "returns empty string when n is 0" , ( ) => {
31+ expect ( repeatStr ( 0 , "hi" ) ) . toBe ( "" ) ;
32+ } ) ;
2033// test("returns empty string when n is 0", () => {
2134// expect(repeatStr(0, "hi")).toBe("");
2235// });
36+ test ( "returns empty string when n is 0" , ( ) => {
37+ expect ( repeatStr ( 0 , "hi" ) ) . toBe ( "" ) ;
38+ } ) ;
0 commit comments