File tree Expand file tree Collapse file tree
Sprint-3/1-implement-and-rewrite-tests/rewrite-tests-with-jest Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -9,12 +9,39 @@ test(`Should return 11 when given an ace card`, () => {
99 expect ( getCardValue ( "A♠" ) ) . toEqual ( 11 ) ;
1010} ) ;
1111
12+ test ( `Should return 10 when given a Joker card` , ( ) => {
13+ expect ( getCardValue ( "J♥" ) ) . toEqual ( 10 ) ;
14+ } ) ;
15+
16+ test ( `Should return 2 when given the 2 card` , ( ) => {
17+ expect ( getCardValue ( "2♠" ) ) . toEqual ( 2 ) ;
18+ } ) ;
19+
20+ test ( `Should return 10 when given a King card` , ( ) => {
21+ expect ( getCardValue ( "K♠" ) ) . toEqual ( 10 ) ;
22+ } ) ;
23+
24+ test ( `Should return 5 when given the 5 card` , ( ) => {
25+ expect ( getCardValue ( "5♠" ) ) . toEqual ( 5 ) ;
26+ } ) ;
27+
28+ test ( `Should return 8 when gine the 8 card` , ( ) => {
29+ expect ( getCardValue ( "8♠" ) ) . toEqual ( 8 ) ;
30+ } ) ;
31+
32+ test ( `Should return 10 when given the Queen card` , ( ) => {
33+ expect ( getCardValue ( "Q♠" ) ) . toEqual ( 10 ) ;
34+ } ) ;
1235// Suggestion: Group the remaining test data into these categories:
1336// Number Cards (2-10)
1437// Face Cards (J, Q, K)
1538// Invalid Cards
1639
1740// To learn how to test whether a function throws an error as expected in Jest,
1841// please refer to the Jest documentation:
19- // https://jestjs.io/docs/expect#tothrowerror
20-
42+ // https://jestjs.io/docs/exåpect#tothrowerror
43+ test ( `Should not return any card should throw an error message` , ( ) => {
44+ expect ( ( ) => {
45+ getCardValue ( "QQ♥" ) ;
46+ } ) . toThrow ( ) ;
47+ } ) ;
You can’t perform that action at this time.
0 commit comments