Skip to content

Commit 951e3a0

Browse files
committed
All done adding in new tests and cleaning up older ones with nwe layout. 20 tests in total now.
1 parent d32864f commit 951e3a0

1 file changed

Lines changed: 22 additions & 32 deletions

File tree

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

Lines changed: 22 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -7,38 +7,6 @@ import { getCardValue } from "../implement/3-get-card-value.js";
77
// // please refer to the Jest documentation:
88
// // https://jestjs.io/docs/expect#tothrowerror
99

10-
// test(`Should throw error "Incorrect suit given" when given wrong letter"`, () => {
11-
// expect(() => getCardValue("2K")).toThrow(new Error("Incorrect suit given"));
12-
// });
13-
14-
// test(`Should throw error "Incorrect face given" when given wrong 2 digit number"`, () => {
15-
// expect(() => getCardValue("25♠")).toThrow(new Error("Incorrect face given"));
16-
// });
17-
18-
// test(`Should throw error "Incorrect face given" when given negative number"`, () => {
19-
// expect(() => getCardValue("-2♠")).toThrow(new Error("Incorrect face given"));
20-
// });
21-
22-
// test(`Should throw error "Incorrect face given" when given a lower case Royal"`, () => {
23-
// expect(() => getCardValue("k♠")).toThrow(new Error("Incorrect face given"));
24-
// });
25-
26-
// test(`Should throw error "Incorrect face given" when given a lower case Ace"`, () => {
27-
// expect(() => getCardValue("a♠")).toThrow(new Error("Incorrect face given"));
28-
// });
29-
30-
// test(`Should throw error "Incorrect face given" when given a letter"`, () => {
31-
// expect(() => getCardValue("I♠")).toThrow(new Error("Incorrect face given"));
32-
// });
33-
34-
// test(`Should throw error "Incorrect face given" when given symbol"`, () => {
35-
// expect(() => getCardValue("🐱♠")).toThrow(new Error("Incorrect face given"));
36-
// });
37-
38-
// test(`Should throw error "Input needed" if no imput given`, () => {
39-
// expect(() => getCardValue("")).toThrow(new Error("Input needed"));
40-
// });
41-
4210
// for valid case:
4311

4412
// any of 2-9 (single digit number) with valid suit
@@ -141,3 +109,25 @@ test(`Should throw error "Incorrect suit given" when given wrong suit with corre
141109
test(`Should throw error "Incorrect suit given" when given wrong suit with correct face Ace"`, () => {
142110
expect(() => getCardValue("A☺")).toThrow(new Error("Incorrect suit given"));
143111
});
112+
113+
test(`Should throw error "Incorrect suit given" when given wrong letter"`, () => {
114+
expect(() => getCardValue("2K")).toThrow(new Error("Incorrect suit given"));
115+
});
116+
117+
test(`Should throw error "Incorrect face given" when given negative number"`, () => {
118+
expect(() => getCardValue("-2♠")).toThrow(new Error("Incorrect face given"));
119+
});
120+
121+
test(`Should throw error "Incorrect face given" when given a lower case Royal"`, () => {
122+
expect(() => getCardValue("j♠")).toThrow(new Error("Incorrect face given"));
123+
expect(() => getCardValue("q♠")).toThrow(new Error("Incorrect face given"));
124+
expect(() => getCardValue("k♠")).toThrow(new Error("Incorrect face given"));
125+
});
126+
127+
test(`Should throw error "Incorrect face given" when given a lower case Ace"`, () => {
128+
expect(() => getCardValue("a♠")).toThrow(new Error("Incorrect face given"));
129+
});
130+
131+
test(`Should throw error "Input needed" if no input given`, () => {
132+
expect(() => getCardValue("")).toThrow(new Error("Input needed"));
133+
});

0 commit comments

Comments
 (0)