From f2960bbd599ff8d98a5a7ffab6c3619a06b47eb0 Mon Sep 17 00:00:00 2001 From: Nik Gilmore Date: Fri, 16 Jan 2026 14:56:51 -0800 Subject: [PATCH] Fix type issues --- .../src/vault/abstractions/cipher-sdk.service.ts | 4 ++-- .../src/vault/services/cipher-sdk.service.spec.ts | 12 ++++-------- libs/common/src/vault/services/cipher-sdk.service.ts | 4 ++-- 3 files changed, 8 insertions(+), 12 deletions(-) diff --git a/libs/common/src/vault/abstractions/cipher-sdk.service.ts b/libs/common/src/vault/abstractions/cipher-sdk.service.ts index e5ac75b7f22..1037bfc2b92 100644 --- a/libs/common/src/vault/abstractions/cipher-sdk.service.ts +++ b/libs/common/src/vault/abstractions/cipher-sdk.service.ts @@ -17,7 +17,7 @@ export abstract class CipherSdkService { cipherView: CipherView, userId: UserId, orgAdmin?: boolean, - ): Promise; + ): Promise; /** * Updates a cipher on the server using the SDK. @@ -33,5 +33,5 @@ export abstract class CipherSdkService { userId: UserId, originalCipherView?: CipherView, orgAdmin?: boolean, - ): Promise; + ): Promise; } diff --git a/libs/common/src/vault/services/cipher-sdk.service.spec.ts b/libs/common/src/vault/services/cipher-sdk.service.spec.ts index 6d5590f9860..e6c4b547e86 100644 --- a/libs/common/src/vault/services/cipher-sdk.service.spec.ts +++ b/libs/common/src/vault/services/cipher-sdk.service.spec.ts @@ -106,28 +106,24 @@ describe("DefaultCipherSdkService", () => { expect(result?.name).toBe(cipherView.name); }); - it("should return void and log error when SDK client is not available", async () => { + it("should throw error and log when SDK client is not available", async () => { sdkService.userClient$.mockReturnValue(of(null)); const cipherView = new CipherView(); cipherView.name = "Test Cipher"; - const result = await cipherSdkService.createWithServer(cipherView, userId); - - expect(result).toBeUndefined(); + await expect(cipherSdkService.createWithServer(cipherView, userId)).rejects.toThrow(); expect(logService.error).toHaveBeenCalledWith( expect.stringContaining("Failed to create cipher"), ); }); - it("should return void and log error when SDK throws an error", async () => { + it("should throw error and log when SDK throws an error", async () => { const cipherView = new CipherView(); cipherView.name = "Test Cipher"; mockCiphersSdk.create.mockRejectedValue(new Error("SDK error")); - const result = await cipherSdkService.createWithServer(cipherView, userId); - - expect(result).toBeUndefined(); + await expect(cipherSdkService.createWithServer(cipherView, userId)).rejects.toThrow(); expect(logService.error).toHaveBeenCalledWith( expect.stringContaining("Failed to create cipher"), ); diff --git a/libs/common/src/vault/services/cipher-sdk.service.ts b/libs/common/src/vault/services/cipher-sdk.service.ts index 51f29e68bea..e4ba3383716 100644 --- a/libs/common/src/vault/services/cipher-sdk.service.ts +++ b/libs/common/src/vault/services/cipher-sdk.service.ts @@ -18,7 +18,7 @@ export class DefaultCipherSdkService implements CipherSdkService { cipherView: CipherView, userId: UserId, orgAdmin?: boolean, - ): Promise { + ): Promise { return await firstValueFrom( this.sdkService.userClient$(userId).pipe( switchMap(async (sdk) => { @@ -48,7 +48,7 @@ export class DefaultCipherSdkService implements CipherSdkService { userId: UserId, originalCipherView?: CipherView, orgAdmin?: boolean, - ): Promise { + ): Promise { return await firstValueFrom( this.sdkService.userClient$(userId).pipe( switchMap(async (sdk) => {