diff --git a/packages/opencode/test/share/share-next.test.ts b/packages/opencode/test/share/share-next.test.ts index feb070a09cb..168243abb52 100644 --- a/packages/opencode/test/share/share-next.test.ts +++ b/packages/opencode/test/share/share-next.test.ts @@ -18,7 +18,7 @@ import { Database } from "@opencode-ai/core/database/database" import { eq } from "drizzle-orm" import { provideTmpdirInstance } from "../fixture/fixture" import { resetDatabase } from "../fixture/db" -import { testEffect } from "../lib/effect" +import { pollWithTimeout, testEffect } from "../lib/effect" const env = Layer.mergeAll( Session.defaultLayer, @@ -301,7 +301,11 @@ describe("ShareNext", () => { }, ], }) - yield* Effect.sleep(1_250) + yield* pollWithTimeout( + Effect.sync(() => (seen.length === 1 ? true : undefined)), + "timed out waiting for share sync", + "5 seconds", + ) expect(seen).toHaveLength(1) expect(seen[0].url).toBe("https://legacy-share.example.com/api/share/shr_abc/sync")