test: tighten config form element helper

This commit is contained in:
Peter Steinberger
2026-05-09 04:47:26 +01:00
parent c9f451996a
commit 497ec02242

View File

@@ -35,8 +35,8 @@ const rootSchema = {
const rootAnalysis = analyzeConfigSchema(rootSchema);
function expectElement<T extends Element>(element: T | null | undefined, label: string): T {
expect(element, label).toEqual(expect.any(Element));
if (!element) {
expect(element instanceof Element, label).toBe(true);
if (!(element instanceof Element)) {
throw new Error(`missing ${label}`);
}
return element;