Adapt tests
This commit is contained in:
@@ -13,19 +13,22 @@ beforeAll(async () => {
|
||||
|
||||
test('base case', async () => {
|
||||
const box = await PwdBox.encrypt(message, k1)
|
||||
const unboxed = await box.decrypt(k1)
|
||||
expect(box).not.toBeNull()
|
||||
const unboxed = await box!.decrypt(k1)
|
||||
expect(unboxed).toEqual(message)
|
||||
})
|
||||
test("Different key can't decrypt", async () => {
|
||||
const box = await PwdBox.encrypt(message, k1)
|
||||
const unboxed = await box.decrypt(k2)
|
||||
expect(box).not.toBeNull()
|
||||
const unboxed = await box!.decrypt(k2)
|
||||
expect(unboxed).toBeNull()
|
||||
})
|
||||
|
||||
test('serialization', async () => {
|
||||
const box = await PwdBox.encrypt(message, k1)
|
||||
expect(box).not.toBeNull()
|
||||
|
||||
const ser = box.toString()
|
||||
const ser = box!.toString()
|
||||
const de = PwdBox.fromString(ser)
|
||||
|
||||
expect(de).not.toBeNull()
|
||||
|
||||
Reference in New Issue
Block a user