Skip to content

Commit

Permalink
refactor: the aes-256-gcm test cases.
Browse files Browse the repository at this point in the history
  • Loading branch information
Leechael committed Jun 13, 2023
1 parent 5ecaa24 commit 5cc97e7
Showing 1 changed file with 9 additions and 6 deletions.
15 changes: 9 additions & 6 deletions frontend/packages/sdk/src/lib/aes-256-gcm.test.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { describe, it } from 'vitest'
import { decrypt, encrypt } from "./aes-256-gcm";

const data = "675abfa9aff26fbf3f4a0bd91f513c40644571f86aa2c18d2d284ad68f17fc97";
Expand All @@ -6,10 +7,12 @@ const encryptedData =
"ba10a8bd942fddc0d3acc5c20e33fb114c292d3521efed516e7e7dc444a92a3f69d69dd07a003cb8160067953d79fad4";
const iv = "989e2eaba6f775ef660ccdd3";

test("aes-256-gcm encrypt", () => {
expect(encrypt(data, key, iv)).toBe(encryptedData);
});
describe('aes-256-gcm utils', () => {
it("can encrypt", ({ expect }) => {
expect(encrypt(data, key, iv)).toBe(encryptedData);
});

test("aes-256-gcm decrypt", () => {
expect(decrypt(encryptedData, key, iv)).toBe(data);
});
it("can decrypt", ({ expect }) => {
expect(decrypt(encryptedData, key, iv)).toBe(data);
});
})

0 comments on commit 5cc97e7

Please sign in to comment.