-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.js
More file actions
42 lines (38 loc) · 1.45 KB
/
test.js
File metadata and controls
42 lines (38 loc) · 1.45 KB
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
// const cipher = require('.');
// const TEXT = 'Testing words work!';
// const ENCODED = cipher.encode(TEXT);
// const DECODED_CAPS = cipher.decode(ENCODED, false);
// const DECODED_TITLE = cipher.decode(ENCODED);
// if (ENCODED !== 'BAABBAABAABAABABAABBABAAAABBABAABBA BABBAABBBABAAABAAABBBAABA BABBAABBBABAAABABABA!') {
// console.error('Encoding not working!');
// console.log(ENCODED);
// process.exit(1);
// }
// console.log('Encoding working!');
// if (DECODED_CAPS !== 'TESTING WORDS WORK!') {
// console.error('Decoding (CAPS) not working!');
// console.log(DECODED_CAPS);
// process.exit(1);
// }
// console.log('Decoding (CAPS) working!');
// if (DECODED_TITLE !== 'Testing Words Work!') {
// console.error('Decoding (TITLE) not working!');
// console.log(DECODED_TITLE);
// process.exit(1);
// }
// console.log('Decoding (TITLE) working!')
const tape = require('tape');
const cipher = require('.');
tape('Encoding', (t) => {
t.plan(1);
t.equal(cipher.encode('Testing words work!'), 'BAABBAABAABAABABAABBABAAAABBABAABBA BABBAABBBABAAABAAABBBAABA BABBAABBBABAAABABABA!');
});
tape('Decoding (CAPS)', (t) => {
t.plan(1);
t.equal(cipher.decode(cipher.encode('Testing words work!'), false), 'TESTING WORDS WORK!');
});
tape('Decoding (TITLE)', (t) => {
t.plan(2);
t.equal(cipher.decode(cipher.encode('Testing words work!')), 'Testing Words Work!');
t.equal(cipher.decode(cipher.encode('Testing words work!'), true), 'Testing Words Work!');
});