Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
MR414N-ID
GitHub Repository: MR414N-ID/botku2
Path: blob/master/node_modules/@bochilteam/scraper/lib/cjs/encryptions/test.js
1126 views
1
"use strict";
2
Object.defineProperty(exports, "__esModule", { value: true });
3
const chai_1 = require("chai");
4
const index_js_1 = require("./index.js");
5
describe('Encryptions', () => {
6
describe('Base64', () => {
7
it('From string to base64', done => {
8
try {
9
const res = (0, index_js_1.toBase64)('Hello World!!');
10
(0, chai_1.expect)(res).to.be.a('string');
11
(0, chai_1.expect)(res).to.be.equal('SGVsbG8gV29ybGQhIQ==');
12
return done();
13
}
14
catch (e) {
15
return done(e);
16
}
17
});
18
it('from base64 to string', done => {
19
try {
20
const res = (0, index_js_1.fromBase64ToString)('SGVsbG8gV29ybGQhIQ==');
21
(0, chai_1.expect)(res).to.be.a('string');
22
(0, chai_1.expect)(res).to.be.equal('Hello World!!');
23
return done();
24
}
25
catch (e) {
26
return done(e);
27
}
28
});
29
});
30
describe('Crypto', () => {
31
it('randomUUID', done => {
32
try {
33
const res = (0, index_js_1.randomUUID)();
34
(0, chai_1.expect)(res).to.be.a('string');
35
return done();
36
}
37
catch (e) {
38
return done(e);
39
}
40
});
41
it('randomBytes', done => {
42
try {
43
const res = (0, index_js_1.randomBytes)(16);
44
(0, chai_1.expect)(res).to.be.a('string');
45
return done();
46
}
47
catch (e) {
48
return done(e);
49
}
50
});
51
it('createHash', done => {
52
try {
53
const res = (0, index_js_1.createHash)('sha256', 'Hello world!!');
54
(0, chai_1.expect)(res).to.be.a('string');
55
(0, chai_1.expect)(res).to.have.length(64);
56
return done();
57
}
58
catch (e) {
59
return done(e);
60
}
61
});
62
});
63
});
64
//# sourceMappingURL=test.js.map
65