Path: blob/master/node_modules/@bochilteam/scraper/lib/esm/encryptions/test.js
1126 views
import { expect } from 'chai';1import { toBase64, fromBase64ToString, randomUUID, randomBytes, createHash } from './index.js';2describe('Encryptions', () => {3describe('Base64', () => {4it('From string to base64', done => {5try {6const res = toBase64('Hello World!!');7expect(res).to.be.a('string');8expect(res).to.be.equal('SGVsbG8gV29ybGQhIQ==');9return done();10}11catch (e) {12return done(e);13}14});15it('from base64 to string', done => {16try {17const res = fromBase64ToString('SGVsbG8gV29ybGQhIQ==');18expect(res).to.be.a('string');19expect(res).to.be.equal('Hello World!!');20return done();21}22catch (e) {23return done(e);24}25});26});27describe('Crypto', () => {28it('randomUUID', done => {29try {30const res = randomUUID();31expect(res).to.be.a('string');32return done();33}34catch (e) {35return done(e);36}37});38it('randomBytes', done => {39try {40const res = randomBytes(16);41expect(res).to.be.a('string');42return done();43}44catch (e) {45return done(e);46}47});48it('createHash', done => {49try {50const res = createHash('sha256', 'Hello world!!');51expect(res).to.be.a('string');52expect(res).to.have.length(64);53return done();54}55catch (e) {56return done(e);57}58});59});60});61//# sourceMappingURL=test.js.map6263