mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-11-23 04:54:00 +01:00
Bound the complete onboarding connection check to two minutes, abort its requests on timeout, and ignore late results. Keep the saved account available for retry and resume its matching unfinished setup after refresh. Verified 242 focused tests, workspace typecheck and build, and the complete hosted CI check set. Greptile is 5/5 with no unresolved review comments. Local full-UI timing failure and interrupted CI runner attempts remain documented in the PR evidence. Co-Authored-By: Paperclip <noreply@paperclip.ing>
29 lines
1.2 KiB
TypeScript
29 lines
1.2 KiB
TypeScript
import { afterEach, describe, expect, it, vi } from "vitest";
|
|
import { ONBOARDING_CONNECTION_TEST_TIMEOUT_MS, runOnboardingConnectionTest } from "./onboarding-connection-test";
|
|
|
|
describe("onboarding connection test deadline", () => {
|
|
afterEach(() => vi.useRealTimers());
|
|
|
|
it("bounds an unresponsive check and aborts its requests", async () => {
|
|
vi.useFakeTimers();
|
|
let signal!: AbortSignal;
|
|
const result = runOnboardingConnectionTest(async current => {
|
|
signal = current;
|
|
return new Promise(() => {});
|
|
});
|
|
const failed = expect(result).rejects.toThrow("The connection test took too long. Try connecting again.");
|
|
await vi.advanceTimersByTimeAsync(ONBOARDING_CONNECTION_TEST_TIMEOUT_MS);
|
|
await failed;
|
|
expect(signal.aborted).toBe(true);
|
|
expect(vi.getTimerCount()).toBe(0);
|
|
});
|
|
|
|
it("clears the deadline after success and preserves genuine failures", async () => {
|
|
vi.useFakeTimers();
|
|
await expect(runOnboardingConnectionTest(async () => "ready")).resolves.toBe("ready");
|
|
const failure = new Error("Paperclip is temporarily unavailable.");
|
|
await expect(runOnboardingConnectionTest(async () => { throw failure; })).rejects.toBe(failure);
|
|
expect(vi.getTimerCount()).toBe(0);
|
|
});
|
|
});
|