-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest.js
34 lines (22 loc) · 1.01 KB
/
test.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
/*
Brief: Testing
Run: node --env-file=.env test.js
*/
import * as helper from './helper.js';
const key = helper.genKeyPair();
console.log(JSON.stringify(key));
console.log('This should show public: ' + helper.validate(key.public));
console.log('This should show private: ' + helper.validate(key.private));
console.log('This should show false: ' + helper.validate('random'));
helper.setupDB();
helper.publicProduce(key.public, 'dataA');
helper.publicProduce(key.public, 'dataB');
helper.publicProduce(key.public, 'dataC');
console.log(JSON.stringify(helper.privateConsume(key.private)));
helper.privateProduce(key.private, 'data');
console.log(JSON.stringify(helper.publicConsume(key.public)));
helper.oneToOneProduce(key.private, 'some Key', 'data for one to one at some key');
console.log(JSON.stringify(helper.oneToOneConsume(key.public, 'some Key')));
console.log(helper.oneToOneIsConsumed(key.private, 'some Key'));
helper.gc();
console.log('End of synchronous execution. Anything logged after this is from async only!')