test: guard cli null helpers

This commit is contained in:
Peter Steinberger
2026-05-11 21:07:47 +01:00
parent e986012043
commit e19c7ab95e
8 changed files with 36 additions and 22 deletions

View File

@@ -51,8 +51,9 @@ type MockCalls = {
};
function requireRecord(value: unknown, label: string): Record<string, unknown> {
expect(typeof value, label).toBe("object");
expect(value, label).not.toBeNull();
if (!value || typeof value !== "object") {
throw new Error(`expected ${label}`);
}
return value as Record<string, unknown>;
}