test: clarify signal and matrix assertions

This commit is contained in:
Peter Steinberger
2026-05-08 12:00:47 +01:00
parent ae8b3de2d9
commit d7853ed5b3
3 changed files with 8 additions and 6 deletions

View File

@@ -140,8 +140,8 @@ describe("resolveMatrixTargets (users)", () => {
kind: "group",
});
expect(userResults.every((entry) => entry.resolved)).toBe(true);
expect(groupResults.every((entry) => entry.resolved)).toBe(true);
expect(userResults.filter((entry) => !entry.resolved)).toEqual([]);
expect(groupResults.filter((entry) => !entry.resolved)).toEqual([]);
expect(listMatrixDirectoryPeersLive).toHaveBeenCalledTimes(1);
expect(listMatrixDirectoryGroupsLive).toHaveBeenCalledTimes(1);
});

View File

@@ -108,6 +108,8 @@ describe("signal groups schema", () => {
},
});
expect(issues.some((issue) => issue.path.join(".").startsWith("groups"))).toBe(true);
expect(issues.map((issue) => issue.path.join("."))).toContainEqual(
expect.stringMatching(/^groups/),
);
});
});

View File

@@ -85,7 +85,7 @@ describe("splitSignalFormattedText", () => {
// First chunk should contain the bold style
const firstChunk = chunks[0];
expect(firstChunk.text).toContain("bold");
expect(firstChunk.styles.some((s) => s.style === "BOLD")).toBe(true);
expect(firstChunk.styles.map((style) => style.style)).toContain("BOLD");
// The bold style should start at position 0 in the first chunk
const boldStyle = requireStyle(firstChunk, "BOLD");
expect(boldStyle.start).toBe(0);
@@ -104,7 +104,7 @@ describe("splitSignalFormattedText", () => {
if (!chunkWithBold) {
throw new Error("chunk containing bold text missing");
}
expect(chunkWithBold.styles.some((s) => s.style === "BOLD")).toBe(true);
expect(chunkWithBold.styles.map((style) => style.style)).toContain("BOLD");
// The bold style should have chunk-local offset (not original text offset)
const boldStyle = requireStyle(chunkWithBold, "BOLD");
@@ -211,7 +211,7 @@ describe("splitSignalFormattedText", () => {
// Bold should be preserved in first chunk
const firstChunk = chunks[0];
if (firstChunk.text.includes("bold")) {
expect(firstChunk.styles.some((s) => s.style === "BOLD")).toBe(true);
expect(firstChunk.styles.map((style) => style.style)).toContain("BOLD");
}
});