1
0
mirror of https://github.com/bitwarden/browser synced 2026-02-10 21:50:15 +00:00

fix broken tests

This commit is contained in:
✨ Audrey ✨
2025-03-24 11:28:05 -04:00
parent e56b54e0f7
commit 071aec2556
3 changed files with 4 additions and 4 deletions

View File

@@ -285,7 +285,7 @@ describe("GeneratorMetadataProvider", () => {
const provider = new GeneratorMetadataProvider(SystemProvider, ApplicationProvider, []);
// `any` cast required because this test subverts the type system
expect(() => provider.algorithms({} as any)).toThrow("algorithm or category required");
expect(() => provider.algorithms({} as any)).toThrow("algorithm or type required");
});
});
@@ -369,7 +369,7 @@ describe("GeneratorMetadataProvider", () => {
const provider = new GeneratorMetadataProvider(SystemProvider, ApplicationProvider, []);
expect(() => provider.algorithms$({} as any, { account$: SomeAccount$ })).toThrow(
"algorithm or category required",
"algorithm or type required",
);
});
});

View File

@@ -215,7 +215,7 @@ export class GeneratorMetadataProvider {
return algorithm;
}
const algorithms = this.algorithms({ type: type });
const algorithms = type ? this.algorithms({ type: type }) : [];
// `?? null` because logging types must be `Jsonify<T>`
const defaultAlgorithm = algorithms.find(isAvailable) ?? null;
this.log.debug(

View File

@@ -9,5 +9,5 @@ export function isAlgorithmRequest(request: MetadataRequest): request is Algorit
}
export function isTypeRequest(request: MetadataRequest): request is TypeRequest {
return !!request.algorithm;
return !!request.type;
}