Skip to content

Commit 09cd676

Browse files
committed
initialised test for 3-get-card-value
1 parent 5b8ba78 commit 09cd676

1 file changed

Lines changed: 10 additions & 2 deletions

File tree

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

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,22 @@
1+
import {getCardValue} from "../implement/3-get-card-value.js";
12
import assert from "node:assert";
23
import test from "node:test";
34

4-
import { getCardValue } from "../implement/3-get-card-value.js";
55

66
// TODO: Write tests to cover all outcomes, including throwing errors for invalid cards.
77

8-
test("Valid single-digit card", () => {
8+
test("Valid number card", () => {
99
assert.equal(getCardValue("9♠"), 9);
1010
});
1111

12+
test("Valid face card", () => {
13+
assert.equal(getCardValue("K♦"), 10);
14+
});
15+
16+
test("Valid ace card", () => {
17+
assert.equal(getCardValue("A♥"), 11);
18+
});
19+
1220
test("Arbitrary non-card string", () => {
1321
assert.throws(() => getCardValue("invalid"), /Expected a number followed by a suit, but got "invalid"/, "Expected clear error");
1422
});

0 commit comments

Comments
 (0)