diff options
Diffstat (limited to 'src/app')
| -rw-r--r-- | src/app/store.test.ts | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/src/app/store.test.ts b/src/app/store.test.ts index 2cf473c..e1a11e0 100644 --- a/src/app/store.test.ts +++ b/src/app/store.test.ts @@ -553,13 +553,17 @@ describe("createAppStore", () => { event: { type: "turn-sealed", conversationId: convId, turnId: "turn-1" }, }); - await new Promise((r) => setTimeout(r, 50)); - - expect(fetchedUrls.some((u) => u.includes(`/conversations/${convId}?sinceSeq=`))).toBe(true); - - await new Promise((r) => setTimeout(r, 50)); + // `turn-sealed` triggers an async `syncTail` (cache.sinceSeq → historySync + // → cache.commit → applyHistory). Poll for the side-effect rather than + // guessing a fixed delay — under suite load a fixed `setTimeout` raced the + // fetch chain and flaked here. + await vi.waitFor(() => { + expect(fetchedUrls.some((u) => u.includes(`/conversations/${convId}?sinceSeq=`))).toBe(true); + }); - expect(store.activeChat.chunks.length).toBeGreaterThan(0); + await vi.waitFor(() => { + expect(store.activeChat.chunks.length).toBeGreaterThan(0); + }); store.dispose(); }); |
