forked from paulroub/tddmash
-
Notifications
You must be signed in to change notification settings - Fork 0
/
highlights.test.js
53 lines (44 loc) · 1.42 KB
/
highlights.test.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
44
45
46
47
48
49
50
51
52
53
const {
GetClockwork
} = require('./clockwork');
const testClock = GetClockwork('en');
test('highlight noon', () => {
const timewords = ["it", "is", "twelve", "o'clock"];
const expected = [
["*it", "*is", "half", "ten"],
["quarter", "twenty"],
["five", "minutes", "to"],
["past", "one", "three"],
["two", "four", "five"],
["six", "seven", "eight"],
["nine", "ten", "eleven"],
["*twelve", "*o'clock"]
];
expect(testClock.highlights(timewords)).toStrictEqual(expected);
});
test('highlight twenty-five after five', () => {
const timewords = ["it", "is", "twenty", "five", "minutes", "past", "five"];
const expected = [
["*it", "*is", "half", "ten"],
["quarter", "*twenty"],
["*five", "*minutes", "to"],
["*past", "one", "three"],
["two", "four", "*five"],
["six", "seven", "eight"],
["nine", "ten", "eleven"],
["twelve", "o'clock"]
];
expect(testClock.highlights(timewords)).toStrictEqual(expected);
});
test('is highlighted', () => {
expect(testClock.isHighlighted('*foo')).toBeTruthy();
});
test('is not highlighted', () => {
expect(testClock.isHighlighted('foo')).toBeFalsy();
});
test('get non-highlighted text', () => {
expect(testClock.getText('foo')).toEqual('foo');
});
test('get highlighted text', () => {
expect(testClock.getText('*foo')).toEqual('foo');
});