From 1aa4c59f1a7c91ccf22c545128eb09e9529aee9a Mon Sep 17 00:00:00 2001 From: IC Rainbow Date: Sat, 2 Nov 2024 13:37:47 +0200 Subject: [PATCH] Fix cfArgs in tests --- tests/ChatTests/Files.hs | 2 +- tests/MobileTests.hs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/ChatTests/Files.hs b/tests/ChatTests/Files.hs index c97193186b..797f2a17b4 100644 --- a/tests/ChatTests/Files.hs +++ b/tests/ChatTests/Files.hs @@ -620,7 +620,7 @@ testXFTPFileTransferEncrypted = createDirectoryIfMissing True "./tests/tmp/alice/" createDirectoryIfMissing True "./tests/tmp/bob/" WFResult cfArgs <- chatWriteFile (chatController alice) srcPath src - let fileJSON = LB.unpack $ J.encode $ CryptoFile srcPath $ Just cfArgs + let fileJSON = LB.unpack $ J.encode $ CryptoFile srcPath cfArgs withXFTPServer $ do connectUsers alice bob alice ##> ("/_send @2 json [{\"msgContent\":{\"type\":\"file\", \"text\":\"\"}, \"fileSource\": " <> fileJSON <> "}]") diff --git a/tests/MobileTests.hs b/tests/MobileTests.hs index 638d3d8078..5f477d55ed 100644 --- a/tests/MobileTests.hs +++ b/tests/MobileTests.hs @@ -282,8 +282,8 @@ testFileCApi fileName tmp = do ptr <- mallocBytes $ B.length src putByteString ptr src r <- peekCAString =<< cChatWriteFile cc cPath ptr cLen - Just (WFResult cfArgs@(CFArgs key nonce)) <- jDecode r - let encryptedFile = CryptoFile path $ Just cfArgs + Just (WFResult cfArgs@(Just (CFArgs key nonce))) <- jDecode r + let encryptedFile = CryptoFile path cfArgs CF.getFileContentsSize encryptedFile `shouldReturn` fromIntegral (B.length src) cKey <- encodedCString key cNonce <- encodedCString nonce @@ -318,8 +318,8 @@ testFileEncryptionCApi fileName tmp = do let toPath = tmp (fileName <> ".encrypted.pdf") cToPath <- newCString toPath r <- peekCAString =<< cChatEncryptFile cc cFromPath cToPath - Just (WFResult cfArgs@(CFArgs key nonce)) <- jDecode r - CF.getFileContentsSize (CryptoFile toPath $ Just cfArgs) `shouldReturn` fromIntegral (B.length src) + Just (WFResult cfArgs@(Just (CFArgs key nonce))) <- jDecode r + CF.getFileContentsSize (CryptoFile toPath cfArgs) `shouldReturn` fromIntegral (B.length src) cKey <- encodedCString key cNonce <- encodedCString nonce let toPath' = tmp (fileName <> ".decrypted.pdf")