-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlib.spec.js
36 lines (31 loc) · 1.12 KB
/
lib.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
const clarify = require('./lib').clarify;
const obfuscate = require('./lib').obfuscate;
const testCases = require('./sample/cases.json');
const testKeys = require('./sample/keys.json');
require('chai').should();
describe('lib', () => {
describe('clarify', ()=>{
testCases.forEach((testCase) => {
it(`${testCase.ciphertext} => ${testCase.plaintext}`, ()=>{
const options = {
encryptionKeys: testKeys
};
clarify(testCase.ciphertext, options).should.equal(testCase.plaintext);
});
});
});
describe('obfuscate', ()=>{
testCases.forEach((testCase) => {
it(`${testCase.plaintext} => ${testCase.ciphertext}`, ()=>{
const options = {
obfuscate: testCase.obfuscate || [],
encryptionKey: {
name: testCase.key,
value: testKeys[testCase.key]
}
};
obfuscate(testCase.plaintext, options).should.equal(testCase.ciphertext);
});
});
});
});