mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-19 07:34:46 +00:00
test: guard cli null helpers
This commit is contained in:
@@ -183,8 +183,9 @@ function expectFirstInstallPlanCallOmitsToken() {
|
||||
}
|
||||
|
||||
function expectFields(value: unknown, expected: Record<string, unknown>): void {
|
||||
expect(value).toBeTypeOf("object");
|
||||
expect(value).not.toBeNull();
|
||||
if (!value || typeof value !== "object") {
|
||||
throw new Error("expected fields object");
|
||||
}
|
||||
const record = value as Record<string, unknown>;
|
||||
for (const [key, expectedValue] of Object.entries(expected)) {
|
||||
expect(record[key], key).toEqual(expectedValue);
|
||||
|
||||
Reference in New Issue
Block a user