File tree Expand file tree Collapse file tree 1 file changed +16
-15
lines changed
Expand file tree Collapse file tree 1 file changed +16
-15
lines changed Original file line number Diff line number Diff line change @@ -27,19 +27,20 @@ function repeatStr(str, count) {
2727module . exports = repeatStr ;
2828
2929
30- // Case: Manual inspection of the Error object
31- // We use try/catch to log the error message to the console
32- // to verify it's working as expected without breaking the test suite.
33- test ( "Should log the specific error message to the console" , ( ) => {
34- try {
35- repeatStr ( "hi" , - 3 ) ;
36- } catch ( error ) {
37- console . log ( "Verified Error Message ->" , error . message ) ;
38-
39- // Check if the message is exactly what we defined
40- expect ( error . message ) . toBe ( "count cannot be negative" ) ;
41- }
4230
43- // Also verify that it actually throws using Jest's built-in matcher
44- expect ( ( ) => repeatStr ( "hi" , - 3 ) ) . toThrow ( ) ;
45- } ) ;
31+
32+
33+ // // Case: Manual inspection of the Error object
34+ // // We use try/catch to log the error message to the console
35+ // // to verify it's working as expected without breaking the test suite.
36+ // test("Should log the specific error message to the console", () => {
37+ // try {
38+ // repeatStr("hi", -3);
39+ // } catch (error) {
40+ // console.log("Verified Error Message ->", error.message);
41+
42+ // // Check if the message is exactly what we defined
43+ // expect(error.message).toBe("count cannot be negative");
44+ // }
45+
46+ // });
You can’t perform that action at this time.
0 commit comments