Skip to content

Commit 8850c1c

Browse files
committed
commit
1 parent 630ae85 commit 8850c1c

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest/3-get-card-value.test.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,23 @@ test(`Should return 11 when given an ace card`, () => {
1414
// Face Cards (J, Q, K)
1515
// Invalid Cards
1616

17+
// Case 2 : Number(2-10)
18+
test('should return the exact number when given an number card', () =>{
19+
expect(getCardValue("5♠")).toEqual(5);
20+
})
21+
22+
//case 3 : face card(J,Q,K)
23+
test('should return number when given face card', () =>{
24+
expect(getCardValue("K♠")).toEqual(10);
25+
})
26+
27+
// case 4: Invalid cards
28+
test('throws new Error', () => {
29+
expect(() => getCardValue("9**")).toThrow("Invalid card");
30+
});
31+
1732
// To learn how to test whether a function throws an error as expected in Jest,
1833
// please refer to the Jest documentation:
1934
// https://jestjs.io/docs/expect#tothrowerror
2035

36+

0 commit comments

Comments
 (0)