1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-08 04:33:38 +00:00

fix types in specs

This commit is contained in:
jaasen-livefront
2025-11-10 13:58:30 -08:00
parent ad23ee9e34
commit 01348f40b7
3 changed files with 19 additions and 19 deletions

View File

@@ -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();

View File

@@ -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);

View File

@@ -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.");
});