mirror of
https://github.com/moltbot/moltbot.git
synced 2026-03-07 22:44:16 +00:00
test(types): fix ts narrowing regressions in followup and matrix queue tests
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user