mirror of
https://github.com/bitwarden/browser
synced 2026-02-10 21:50:15 +00:00
fix broken tests
This commit is contained in:
@@ -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",
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user