-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbob.spec.js
125 lines (100 loc) · 3.55 KB
/
bob.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
var Bob = require('./bob.js');
describe('Bob', function () {
var bob = new Bob();
it('stating something', function () {
var result = bob.hey('Tom-ay-to, tom-aaaah-to.');
expect(result).toEqual('Whatever.');
});
it('shouting', function () {
var result = bob.hey('WATCH OUT!');
expect(result).toEqual('Whoa, chill out!');
});
it('shouting gibberish', function () {
var result = bob.hey('FCECDFCAAB');
expect(result).toEqual('Whoa, chill out!');
});
it('asking a question', function () {
var result = bob.hey('Does this cryogenic chamber make me look fat?');
expect(result).toEqual('Sure.');
});
it('asking a numeric question', function () {
var result = bob.hey('You are, what, like 15?');
expect(result).toEqual('Sure.');
});
it('asking gibberish', function () {
var result = bob.hey('fffbbcbeab?');
expect(result).toEqual('Sure.');
});
it('talking forcefully', function () {
var result = bob.hey('Let\'s go make out behind the gym!');
expect(result).toEqual('Whatever.');
});
it('using acronyms in regular speech', function () {
var result = bob.hey('It\'s OK if you don\'t want to go to the DMV.');
expect(result).toEqual('Whatever.');
});
it('forceful questions', function () {
var result = bob.hey('WHAT THE HELL WERE YOU THINKING?');
expect(result).toEqual('Whoa, chill out!');
});
it('shouting numbers', function () {
var result = bob.hey('1, 2, 3 GO!');
expect(result).toEqual('Whoa, chill out!');
});
it('only numbers', function () {
var result = bob.hey('1, 2, 3');
expect(result).toEqual('Whatever.');
});
it('question with only numbers', function () {
var result = bob.hey('4?');
expect(result).toEqual('Sure.');
});
it('shouting with special characters', function () {
var result = bob.hey('ZOMG THE %^*@#$(*^ ZOMBIES ARE COMING!!11!!1!');
expect(result).toEqual('Whoa, chill out!');
});
it('shouting with no exclamation mark', function () {
var result = bob.hey('I HATE YOU');
expect(result).toEqual('Whoa, chill out!');
});
it('statement containing question mark', function () {
var result = bob.hey('Ending with a ? means a question.');
expect(result).toEqual('Whatever.');
});
it('prattling on', function () {
var result = bob.hey('Wait! Hang on. Are you going to be OK?');
expect(result).toEqual('Sure.');
});
it('silence', function () {
var result = bob.hey('');
expect(result).toEqual('Fine. Be that way!');
});
it('prolonged silence', function () {
var result = bob.hey(' ');
expect(result).toEqual('Fine. Be that way!');
});
it('alternate silence', function () {
var result = bob.hey('\t\t\t\t\t\t\t\t\t\t');
expect(result).toEqual('Fine. Be that way!');
});
it('multiple line question', function () {
var result = bob.hey('\nDoes this cryogenic chamber make me look fat?\nno');
expect(result).toEqual('Whatever.');
});
it('starting with whitespace', function () {
var result = bob.hey(' hmmmmmmm...');
expect(result).toEqual('Whatever.');
});
it('ending with whitespace', function () {
var result = bob.hey('Okay if like my spacebar quite a bit? ');
expect(result).toEqual('Sure.');
});
it('other whitespace', function () {
var result = bob.hey('\n\r \t');
expect(result).toEqual('Fine. Be that way!');
});
it('non-question ending with whitespace', function () {
var result = bob.hey('This is a statement ending with whitespace ');
expect(result).toEqual('Whatever.');
});
});