test: tighten extension shape assertions

This commit is contained in:
Peter Steinberger
2026-05-08 14:21:44 +01:00
parent 49f1f712d6
commit aefba95dba
3 changed files with 14 additions and 3 deletions

View File

@@ -272,7 +272,8 @@ describe("parseLineDirectives", () => {
expect(flexMessage.contents?.footer?.contents?.length, testCase.name).toBeGreaterThan(0);
}
if ("expectBodyContents" in testCase && testCase.expectBodyContents) {
expect(flexMessage.contents?.body?.contents, testCase.name).toEqual(expect.any(Array));
expect(Array.isArray(flexMessage.contents?.body?.contents), testCase.name).toBe(true);
expect(flexMessage.contents?.body?.contents?.length, testCase.name).toBeGreaterThan(0);
}
}
});

View File

@@ -96,7 +96,17 @@ describe("FileBackedMatrixSyncStore", () => {
type: "com.openclaw.test",
},
]);
expect(savedSync?.roomsData.join?.["!room:example.org"]).toEqual(expect.any(Object));
expect(savedSync?.roomsData.join?.["!room:example.org"]).toMatchObject({
timeline: {
events: [
{
event_id: "$message",
sender: "@user:example.org",
type: "m.room.message",
},
],
},
});
expect(secondStore.hasSavedSyncFromCleanShutdown()).toBe(false);
});

View File

@@ -429,7 +429,7 @@ describe("nostr-profile-http", () => {
const data = expectBadRequestResponse(res);
// The schema validation catches non-https URLs before SSRF check
expect(data.error).toBe("Validation failed");
expect(data.details).toEqual(expect.any(Array));
expect(Array.isArray(data.details)).toBe(true);
expect(data.details).toEqual(expect.arrayContaining([expect.stringContaining("https")]));
});