mirror of
https://github.com/wkulhanek/bonob.git
synced 2025-12-21 17:33:29 +01:00
bump libs (#211)
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { left, right } from 'fp-ts/Either'
|
||||
|
||||
import { cryptoEncryption, jwsEncryption } from '../src/encryption';
|
||||
|
||||
describe("jwsEncryption", () => {
|
||||
@@ -7,7 +9,7 @@ describe("jwsEncryption", () => {
|
||||
const value = "bobs your uncle"
|
||||
const hash = e.encrypt(value)
|
||||
expect(hash).not.toContain(value);
|
||||
expect(e.decrypt(hash)).toEqual(value);
|
||||
expect(e.decrypt(hash)).toEqual(right(value));
|
||||
});
|
||||
|
||||
it("returns different values for different secrets", () => {
|
||||
@@ -29,7 +31,7 @@ describe("cryptoEncryption", () => {
|
||||
const value = "bobs your uncle"
|
||||
const hash = e.encrypt(value)
|
||||
expect(hash).not.toContain(value);
|
||||
expect(e.decrypt(hash)).toEqual(value);
|
||||
expect(e.decrypt(hash)).toEqual(right(value));
|
||||
});
|
||||
|
||||
it("returns different values for different secrets", () => {
|
||||
@@ -42,4 +44,10 @@ describe("cryptoEncryption", () => {
|
||||
|
||||
expect(h1).not.toEqual(h2);
|
||||
});
|
||||
|
||||
it("should return left on invalid value", () => {
|
||||
const e = cryptoEncryption("secret squirrel");
|
||||
|
||||
expect(e.decrypt("not-valid")).toEqual(left("Invalid value to decrypt"));
|
||||
});
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user