test(types): fix ts narrowing regressions in followup and matrix queue tests

This commit is contained in:
Peter Steinberger
2026-02-24 23:54:45 +00:00
parent e22a2d77ba
commit b0bb3cca8a
2 changed files with 8 additions and 2 deletions

View File

@@ -79,8 +79,11 @@ describe("enqueueSend", () => {
await vi.advanceTimersByTimeAsync(DEFAULT_SEND_GAP_MS);
const firstResult = await first;
expect(firstResult.ok).toBe(false);
if (firstResult.ok) {
throw new Error("expected first queue item to fail");
}
expect(firstResult.error).toBeInstanceOf(Error);
expect((firstResult.error as Error).message).toBe("boom");
expect(firstResult.error.message).toBe("boom");
const second = enqueueSend("!room:example.org", async () => "ok");
await vi.advanceTimersByTimeAsync(DEFAULT_SEND_GAP_MS);
@@ -110,6 +113,9 @@ describe("enqueueSend", () => {
gate.resolve();
const firstResult = await first;
expect(firstResult.ok).toBe(false);
if (firstResult.ok) {
throw new Error("expected head queue item to fail");
}
expect(firstResult.error).toBeInstanceOf(Error);
await vi.advanceTimersByTimeAsync(DEFAULT_SEND_GAP_MS);

View File

@@ -64,7 +64,7 @@ const baseQueuedRun = (messageProvider = "whatsapp"): FollowupRun =>
}) as FollowupRun;
function createQueuedRun(
overrides: Partial<FollowupRun> & { run?: Partial<FollowupRun["run"]> } = {},
overrides: Partial<Omit<FollowupRun, "run">> & { run?: Partial<FollowupRun["run"]> } = {},
): FollowupRun {
const base = baseQueuedRun();
return {