From 95fdef0b9bde093dc0c9489ebc5a2665e809c8f8 Mon Sep 17 00:00:00 2001 From: "@greweb" Date: Thu, 18 Jul 2024 11:02:05 +0200 Subject: [PATCH] test(cloudsync): improve cipher tests (#7344) --- .../src/cloudsync/__tests__/cipher.test.ts | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/libs/live-wallet/src/cloudsync/__tests__/cipher.test.ts b/libs/live-wallet/src/cloudsync/__tests__/cipher.test.ts index df8b3e8125a5..480830c8d90b 100644 --- a/libs/live-wallet/src/cloudsync/__tests__/cipher.test.ts +++ b/libs/live-wallet/src/cloudsync/__tests__/cipher.test.ts @@ -12,7 +12,16 @@ describe("makeCipher on static data set", () => { walletSyncEncryptionKey: "test-encryption-key", applicationPath: "0'/16'/0'", }; - const data = new Uint8Array([1, 2, 3, 4, 5]); + const data = { + foo: [ + { + bar: "baz", + }, + 4, + ], + emojis: "🚀🌕🦄", + number: 42, + }; it("encrypt/decrypt works together", async () => { const encrypted = await cipher.encrypt(trustchain, data); @@ -22,12 +31,15 @@ describe("makeCipher on static data set", () => { it("encrypt is stable (non regression on encrypted data)", async () => { const encrypted = await cipher.encrypt(trustchain, data); - expect(encrypted).toBe("h2NUqc2vTc0rrs2rTc0trs2tTc0prs2pTc0urs2uTc1S+v+f2Pnn"); + expect(encrypted).toBe( + "h2NUqbU0MKhNdVGptbXTrU39baq1SsXZTsW1VkYGpmY6v17wDJjKg2cgzAo8A5rStcW1hlpGtla/Wtm5Sv9ZJOjg", + ); }); it("decrypt is stable (non regression on decrypted data)", async () => { - const encrypted = "h2NUqc2vTc0rrs2rTc0trs2tTc0prs2pTc0urs2uTc1S+v+f2Pnn"; + const encrypted = + "h2NUqbU0MKhNdVGptbXTrU39baq1SsXZTsW1VkYGpmY6v17wDJjKg2cgzAo8A5rStcW1hlpGtla/Wtm5Sv9ZJOjg"; const decrypted = await cipher.decrypt(trustchain, encrypted); - expect(decrypted).toMatchObject(data); + expect(decrypted).toEqual(data); }); });