From 01348f40b7f226b07acc52b43cb1668b6a8fcc72 Mon Sep 17 00:00:00 2001 From: jaasen-livefront Date: Mon, 10 Nov 2025 13:58:30 -0800 Subject: [PATCH] fix types in specs --- .../export/fido2-credentials.export.spec.ts | 28 +++++++++---------- .../export/password-history.export.spec.ts | 4 +-- .../src/models/export/ssh-key.export.spec.ts | 6 ++-- 3 files changed, 19 insertions(+), 19 deletions(-) diff --git a/libs/common/src/models/export/fido2-credentials.export.spec.ts b/libs/common/src/models/export/fido2-credentials.export.spec.ts index 0d4a4827ec5..69c3637f9eb 100644 --- a/libs/common/src/models/export/fido2-credentials.export.spec.ts +++ b/libs/common/src/models/export/fido2-credentials.export.spec.ts @@ -21,8 +21,8 @@ describe("Fido2CredentialsExport", () => { it.each([null, undefined, "", " "])("should throw when credentialId is %p", (value) => { const fido2Credential = new Fido2CredentialExport({ ...validFido2Credential, - credentialId: value, - }); + credentialId: value as any, + } as any); expect(() => Fido2CredentialExport.toView(fido2Credential)).toThrow( "FIDO2 credential ID is required.", ); @@ -31,8 +31,8 @@ describe("Fido2CredentialsExport", () => { it.each([null, undefined, "", " "])("should throw when keyType is %p", (value) => { const fido2Credential = new Fido2CredentialExport({ ...validFido2Credential, - keyType: value, - }); + keyType: value as any, + } as any); expect(() => Fido2CredentialExport.toView(fido2Credential)).toThrow( "FIDO2 key type is required.", ); @@ -41,8 +41,8 @@ describe("Fido2CredentialsExport", () => { it.each([null, undefined, "", " "])("should throw when keyAlgorithm is %p", (value) => { const fido2Credential = new Fido2CredentialExport({ ...validFido2Credential, - keyAlgorithm: value, - }); + keyAlgorithm: value as any, + } as any); expect(() => Fido2CredentialExport.toView(fido2Credential)).toThrow( "FIDO2 key algorithm is required.", ); @@ -51,8 +51,8 @@ describe("Fido2CredentialsExport", () => { it.each([null, undefined, "", " "])("should throw when keyCurve is %p", (value) => { const fido2Credential = new Fido2CredentialExport({ ...validFido2Credential, - keyCurve: value, - }); + keyCurve: value as any, + } as any); expect(() => Fido2CredentialExport.toView(fido2Credential)).toThrow( "FIDO2 key curve is required.", ); @@ -61,8 +61,8 @@ describe("Fido2CredentialsExport", () => { it.each([null, undefined, "", " "])("should throw when keyValue is %p", (value) => { const fido2Credential = new Fido2CredentialExport({ ...validFido2Credential, - keyValue: value, - }); + keyValue: value as any, + } as any); expect(() => Fido2CredentialExport.toView(fido2Credential)).toThrow( "FIDO2 key value is required.", ); @@ -71,8 +71,8 @@ describe("Fido2CredentialsExport", () => { it.each([null, undefined, "", " "])("should throw when rpId is %p", (value) => { const fido2Credential = new Fido2CredentialExport({ ...validFido2Credential, - rpId: value, - }); + rpId: value as any, + } as any); expect(() => Fido2CredentialExport.toView(fido2Credential)).toThrow( "FIDO2 relying party ID is required.", ); @@ -82,7 +82,7 @@ describe("Fido2CredentialsExport", () => { const fido2Credential = new Fido2CredentialExport({ ...validFido2Credential, counter: value as any, - }); + } as any); expect(() => Fido2CredentialExport.toView(fido2Credential)).toThrow( "FIDO2 counter is required.", ); @@ -90,7 +90,7 @@ describe("Fido2CredentialsExport", () => { it("should succeed with valid inputs", () => { const fido2Credential = new Fido2CredentialExport( - Fido2CredentialView.fromJSON({ ...validFido2Credential }), + Fido2CredentialView.fromJSON({ ...validFido2Credential } as any), ); const result = Fido2CredentialExport.toView(fido2Credential); expect(result).toBeDefined(); diff --git a/libs/common/src/models/export/password-history.export.spec.ts b/libs/common/src/models/export/password-history.export.spec.ts index 14dad7ea177..178d63b0e0c 100644 --- a/libs/common/src/models/export/password-history.export.spec.ts +++ b/libs/common/src/models/export/password-history.export.spec.ts @@ -6,7 +6,7 @@ describe("PasswordHistoryExport", () => { const passwordHistory = new PasswordHistoryExport({ password: value as any, lastUsedDate: new Date(), - }); + } as any); expect(() => PasswordHistoryExport.toView(passwordHistory)).toThrow( "Password history password is required.", ); @@ -16,7 +16,7 @@ describe("PasswordHistoryExport", () => { const validPasswordHistory = { password: "PASSWORD", lastUsedDate: new Date("2023-01-01T00:00:00Z"), - }; + } as any; const result = PasswordHistoryExport.toView(new PasswordHistoryExport(validPasswordHistory)); expect(result).toBeDefined(); expect(result.password).toBe(validPasswordHistory.password); diff --git a/libs/common/src/models/export/ssh-key.export.spec.ts b/libs/common/src/models/export/ssh-key.export.spec.ts index 9e54c120a2a..5215c048444 100644 --- a/libs/common/src/models/export/ssh-key.export.spec.ts +++ b/libs/common/src/models/export/ssh-key.export.spec.ts @@ -10,17 +10,17 @@ describe("toView", () => { }; it.each([null, undefined, "", " "])("should throw when privateKey is %p", (value) => { - const sshKey = new SshKeyExport({ ...validSshKey, privateKey: value }); + const sshKey = new SshKeyExport({ ...validSshKey, privateKey: value as any } as any); expect(() => SshKeyExport.toView(sshKey)).toThrow("SSH key private key is required."); }); it.each([null, undefined, "", " "])("should throw when publicKey is %p", (value) => { - const sshKey = new SshKeyExport({ ...validSshKey, publicKey: value }); + const sshKey = new SshKeyExport({ ...validSshKey, publicKey: value as any } as any); expect(() => SshKeyExport.toView(sshKey)).toThrow("SSH key public key is required."); }); it.each([null, undefined, "", " "])("should throw when keyFingerprint is %p", (value) => { - const sshKey = new SshKeyExport({ ...validSshKey, keyFingerprint: value }); + const sshKey = new SshKeyExport({ ...validSshKey, keyFingerprint: value as any } as any); expect(() => SshKeyExport.toView(sshKey)).toThrow("SSH key fingerprint is required."); });