|
1
|
|
|
import { isPangram } from "./pangram"; |
|
2
|
|
|
|
|
3
|
|
|
describe("Pangram()", () => { |
|
4
|
|
|
test("empty sentence", () => { |
|
5
|
|
|
expect(isPangram("")).toBe(false); |
|
6
|
|
|
}); |
|
7
|
|
|
|
|
8
|
|
|
test("recognizes a perfect lower case pangram", () => { |
|
9
|
|
|
expect(isPangram("abcdefghijklmnopqrstuvwxyz")).toBe(true); |
|
10
|
|
|
}); |
|
11
|
|
|
|
|
12
|
|
|
test("pangram with only lower case", () => { |
|
13
|
|
|
expect(isPangram("the quick brown fox jumps over the lazy dog")).toBe(true); |
|
14
|
|
|
}); |
|
15
|
|
|
|
|
16
|
|
|
test("missing character 'x'", () => { |
|
17
|
|
|
expect( |
|
18
|
|
|
isPangram("a quick movement of the enemy will jeopardize five gunboats") |
|
19
|
|
|
).toBe(false); |
|
20
|
|
|
}); |
|
21
|
|
|
|
|
22
|
|
|
test("another missing character, e.g. 'h'", () => { |
|
23
|
|
|
expect(isPangram("five boxing wizards jump quickly at it")).toBe(false); |
|
24
|
|
|
}); |
|
25
|
|
|
|
|
26
|
|
|
test("pangram with underscores", () => { |
|
27
|
|
|
expect(isPangram("the_quick_brown_fox_jumps_over_the_lazy_dog")).toBe(true); |
|
28
|
|
|
}); |
|
29
|
|
|
|
|
30
|
|
|
test("pangram with numbers", () => { |
|
31
|
|
|
expect(isPangram("the 1 quick brown fox jumps over the 2 lazy dogs")).toBe( |
|
32
|
|
|
true |
|
33
|
|
|
); |
|
34
|
|
|
}); |
|
35
|
|
|
|
|
36
|
|
|
test("missing letters replaced by numbers", () => { |
|
37
|
|
|
expect(isPangram("7h3 qu1ck brown fox jumps ov3r 7h3 lazy dog")).toBe( |
|
38
|
|
|
false |
|
39
|
|
|
); |
|
40
|
|
|
}); |
|
41
|
|
|
|
|
42
|
|
|
test("pangram with mixed case and punctuation", () => { |
|
43
|
|
|
expect(isPangram('"Five quacking Zephyrs jolt my wax bed."')).toBe(true); |
|
44
|
|
|
}); |
|
45
|
|
|
|
|
46
|
|
|
test("upper and lower case versions of the same character should not be counted separately", () => { |
|
47
|
|
|
expect(isPangram("the quick brown fox jumps over with lazy FX")).toBe( |
|
48
|
|
|
false |
|
49
|
|
|
); |
|
50
|
|
|
}); |
|
51
|
|
|
}); |
|
52
|
|
|
|