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