-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcipher.test.js
More file actions
30 lines (23 loc) · 771 Bytes
/
cipher.test.js
File metadata and controls
30 lines (23 loc) · 771 Bytes
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
let { encipher, decipher} = require('./cipher.js');
describe('encipher', function() {
test('can shift a single value', function() {
expect(encipher('hello', 1)).toBe('ifmmp');
});
test('can shift any value', function() {
expect(encipher('hello', 7)).toBe('olssv');
});
test('can shift to the beginning of the alphabet', function() {
expect(encipher('zygote', 4)).toBe('dcksxi');
});
});
describe('decipher', function() {
test('can shift a single value', function() {
expect(decipher('ifmmp', 1)).toBe('hello');
});
test('can shift any value', function() {
expect(decipher('olssv', 7)).toBe('hello');
});
test('can shift to the end of the alphabet', function() {
expect(decipher('dcksxi', 4)).toBe('zygote');
});
});