diff options
| author | Adam Malczewski <[email protected]> | 2026-06-28 00:20:52 +0900 |
|---|---|---|
| committer | Adam Malczewski <[email protected]> | 2026-06-28 08:50:13 +0900 |
| commit | 49d32e5492e57684af4441a0a58df236dca8104a (patch) | |
| tree | 385ab874916b43a3a43d552491822e1f744bcf53 /src/app/store.test.ts | |
| parent | 5f97ad6468e857b2dc0dc6567c1d60a55ce1e897 (diff) | |
| download | dispatch-web-49d32e5492e57684af4441a0a58df236dca8104a.tar.gz dispatch-web-49d32e5492e57684af4441a0a58df236dca8104a.zip | |
fix(cache-display): fix stale cache info on unloaded steps + missing cache percentages on active steps
Diffstat (limited to 'src/app/store.test.ts')
| -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(); }); |
