-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsecret-handshake.spec.js
36 lines (28 loc) · 1.17 KB
/
secret-handshake.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
import { secretHandshake } from './secret-handshake';
describe('Secret Handshake', () => {
test('binary 1 (decimal 1) is a wink', () => {
expect(secretHandshake(1)).toEqual(['wink']);
});
test('binary 10 (decimal 2) is a double blink', () => {
expect(secretHandshake(2)).toEqual(['double blink']);
});
test('binary 100 (decimal 4) is close your eyes', () => {
expect(secretHandshake(4)).toEqual(['close your eyes']);
});
test('binary 1000 (decimal 8) is jump', () => {
expect(secretHandshake(8)).toEqual(['jump']);
});
test('binary 11 (decimal 3) is wink and double blink', () => {
expect(secretHandshake(3)).toEqual(['wink', 'double blink']);
});
test('binary 10011 (decimal 19) is double blink and wink', () => {
expect(secretHandshake(19)).toEqual(['double blink', 'wink']);
});
test('binary 11111 (decimal 31) is jump, close your eyes, double blink, and wink', () => {
expect(secretHandshake(31)).toEqual(['jump', 'close your eyes', 'double blink', 'wink']);
});
test('text is an invalid secret handshake', () => {
expect(() => secretHandshake('piggies'))
.toThrow(new Error('Handshake must be a number'));
});
});