Skip to content

Commit 8b16f37

Browse files
committed
Solved ex1-giveCompliment and ex2-dogYears
1 parent 90daffc commit 8b16f37

File tree

3 files changed

+21
-50
lines changed

3 files changed

+21
-50
lines changed

.test-summary/TEST_SUMMARY.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
| Exercise | Passed | Failed | ESLint |
88
|----------------------|--------|--------|--------|
9-
| ex1-giveCompliment | 3 | 4 ||
9+
| ex1-giveCompliment | 7 | - ||
1010
| ex2-dogYears | 7 | - ||
1111
| ex3-tellFortune | 10 | - ||
1212
| ex4-shoppingCart | - | - ||

1-JavaScript/Week2/assignment/ex1-giveCompliment.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,4 @@
1-
/* -----------------------------------------------------------------------------
2-
Full description at: https://github.com/HackYourFuture/Assignments/tree/main/1-JavaScript/Week3#exercise-1-you-are-amazing
3-
4-
1. Complete the function named `giveCompliment`as follows:
5-
6-
export function giveCompliment(name) {
1+
export function giveCompliment(name) {
72
const compliments = [
83
"great",
94
"awesome",
@@ -16,6 +11,7 @@ Full description at: https://github.com/HackYourFuture/Assignments/tree/main/1-J
1611
"marvelous",
1712
"exceptional"
1813
];
14+
1915
const i = Math.floor(Math.random() * compliments.length);
2016
return `You are ${compliments[i]}, ${name}!`;
2117
}
@@ -34,4 +30,4 @@ function main() {
3430

3531
if (process.env.NODE_ENV !== "test") {
3632
main();
37-
}
33+
}
Lines changed: 17 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,23 @@
11
*** Unit Test Error Report ***
22

3-
Command failed: npx jest C:/Users/Rimha/Assignments-Cohort54/.dist/1-JavaScript/Week2/unit-tests/ex1-giveCompliment.test.js --colors --noStackTrace --json
4-
FAIL .dist/1-JavaScript/Week2/unit-tests/ex1-giveCompliment.test.js
3+
PASS .dist/1-JavaScript/Week2/unit-tests/ex1-giveCompliment.test.js
54
js-wk2-ex1-giveCompliment
6-
❌ should exist and be executable (4 ms)
7-
✅ should have all TODO comments removed (1 ms)
8-
✅ `giveCompliment` should not contain unneeded console.log calls (1 ms)
9-
❌ should take a single parameter (1 ms)
10-
✅ should include a `compliments` array inside its function body (1 ms)
11-
❌ the `compliments` array should be initialized with 10 strings (1 ms)
12-
❌ should give a random compliment: You are `compliment`, `name`!
13-
14-
● js-wk2-ex1-giveCompliment › should exist and be executable
15-
16-
expect(received).toBeDefined()
17-
18-
Received: undefined
19-
20-
● js-wk2-ex1-giveCompliment › should take a single parameter
21-
22-
expect(received).toHaveLength(expected)
23-
24-
Matcher error: received value must have a length property whose value must be a number
25-
26-
Received has value: undefined
27-
28-
● js-wk2-ex1-giveCompliment › the `compliments` array should be initialized with 10 strings
29-
30-
expect(received).toHaveLength(expected)
31-
32-
Expected length: 10
33-
Received length: 0
34-
Received array: []
35-
36-
● js-wk2-ex1-giveCompliment › should give a random compliment: You are `compliment`, `name`!
37-
38-
expect(received).toBeDefined()
39-
40-
Received: undefined
41-
42-
Test Suites: 1 failed, 1 total
43-
Tests: 4 failed, 3 passed, 7 total
5+
✅ should exist and be executable (1 ms)
6+
✅ should have all TODO comments removed
7+
✅ `giveCompliment` should not contain unneeded console.log calls
8+
✅ should take a single parameter (1 ms)
9+
✅ should include a `compliments` array inside its function body
10+
✅ the `compliments` array should be initialized with 10 strings
11+
✅ should give a random compliment: You are `compliment`, `name`!
12+
13+
Test Suites: 1 passed, 1 total
14+
Tests: 7 passed, 7 total
4415
Snapshots: 0 total
45-
Time: 1.293 s
16+
Time: 0.715 s, estimated 1 s
4617
Ran all test suites matching /C:\\Users\\Rimha\\Assignments-Cohort54\\.dist\\1-JavaScript\\Week2\\unit-tests\\ex1-giveCompliment.test.js/i.
4718
No linting errors detected.
48-
No spelling errors detected.
19+
20+
21+
*** Spell Checker Report ***
22+
23+
1-JavaScript/Week2/assignment/ex1-giveCompliment.js:25:21 - Unknown word (Hadid)

0 commit comments

Comments
 (0)