From 2e9b34e0c322dc0a8782d84b60bf1679d69ff006 Mon Sep 17 00:00:00 2001 From: Florian Duros Date: Tue, 1 Aug 2023 14:20:01 +0200 Subject: [PATCH] Throw error if missing `userId` in `CryptoApi.findVerificationRequestDMInProgress` (#3641) --- spec/unit/rust-crypto/rust-crypto.spec.ts | 6 ++++-- src/rust-crypto/rust-crypto.ts | 3 +-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/spec/unit/rust-crypto/rust-crypto.spec.ts b/spec/unit/rust-crypto/rust-crypto.spec.ts index c21e34531..d306166de 100644 --- a/spec/unit/rust-crypto/rust-crypto.spec.ts +++ b/spec/unit/rust-crypto/rust-crypto.spec.ts @@ -578,9 +578,11 @@ describe("RustCrypto", () => { }); describe("findVerificationRequestDMInProgress", () => { - it("returns undefined if the userId is not provided", async () => { + it("throws an error if the userId is not provided", async () => { const rustCrypto = await makeTestRustCrypto(); - expect(rustCrypto.findVerificationRequestDMInProgress(testData.TEST_ROOM_ID)).not.toBeDefined(); + expect(() => rustCrypto.findVerificationRequestDMInProgress(testData.TEST_ROOM_ID)).toThrow( + "missing userId", + ); }); }); }); diff --git a/src/rust-crypto/rust-crypto.ts b/src/rust-crypto/rust-crypto.ts index 8bed4c9e9..788238e6a 100644 --- a/src/rust-crypto/rust-crypto.ts +++ b/src/rust-crypto/rust-crypto.ts @@ -686,8 +686,7 @@ export class RustCrypto extends TypedEventEmitter