Skip to content

Evenfire is an intelligence layer platform for running LLM agents that take real actions, on your infrastructure

TypeScript

test(control-ui): r7-l21 stabilize producer-backed refresh fixture

Josué767127badffe
diff --git a/control-ui/components/__tests__/GfsBrowser.revalidation.integration.test.tsx b/control-ui/components/__tests__/GfsBrowser.revalidation.integration.test.tsx
index 1c5de2bbe..1cce06674 100644
--- a/control-ui/components/__tests__/GfsBrowser.revalidation.integration.test.tsx
+++ b/control-ui/components/__tests__/GfsBrowser.revalidation.integration.test.tsx
@@ -380,7 +380,8 @@ describe('GfsBrowser authoritative revalidation integration', () => {
const refresh = new Promise<Response>(resolve => {
finishRefresh = resolve
})
- let folderPageReads = 0
+ let streamRefreshReads = 0
+ let streamRefreshStarted = false
let streamController: ReadableStreamDefaultController<Uint8Array> | null = null
vi.stubGlobal(
'fetch',
@@ -406,9 +407,11 @@ describe('GfsBrowser authoritative revalidation integration', () => {
if (url.pathname === folderPath) {
const cursor = url.searchParams.get('cursor')
if (cursor) return jsonResponse({ items: [second], nextCursor: null })
- folderPageReads += 1
- if (folderPageReads === 1) return jsonResponse({ items: [first], nextCursor: 'page-2' })
- return refresh
+ if (streamRefreshStarted) {
+ streamRefreshReads += 1
+ return refresh
+ }
+ return jsonResponse({ items: [first], nextCursor: 'page-2' })
}
if (
url.pathname.endsWith('/api/v1/gfs/resolve') ||
@@ -435,26 +438,17 @@ describe('GfsBrowser authoritative revalidation integration', () => {
)
await waitFor(() => expect(streamController).not.toBeNull())
await screen.findByRole('button', { name: 'work' })
- await waitFor(() => expect(folderPageReads).toBe(1))
- await act(async () => new Promise(resolve => setTimeout(resolve, 0)))
fireEvent.click(screen.getByRole('button', { name: 'work' }))
await screen.findByRole('button', { name: 'first.txt' })
fireEvent.click(await screen.findByRole('button', { name: 'Load more' }))
await screen.findByRole('button', { name: 'second.txt' })
+ const producerFrame = await controlApiProducerFrame()
await act(async () => {
- streamController!.enqueue(
- new TextEncoder().encode(
- `${JSON.stringify({
- schemaVersion: 1,
- type: 'scope.invalidated',
- cursor: 'd119f895-1ef8-4e73-8f08-f9754919682a',
- scopes: ['gfs'],
- })}\n`
- )
- )
+ streamRefreshStarted = true
+ streamController!.enqueue(new TextEncoder().encode(`${producerFrame}\n`))
})
- await waitFor(() => expect(folderPageReads).toBeGreaterThan(1))
+ await waitFor(() => expect(streamRefreshReads).toBeGreaterThan(0))
expect(screen.getByRole('button', { name: 'first.txt' })).toBeVisible()
expect(screen.getByRole('button', { name: 'second.txt' })).toBeVisible()
diff --git a/control-ui/package-lock.json b/control-ui/package-lock.json
index dee366ee1..553f5d37b 100644
--- a/control-ui/package-lock.json
+++ b/control-ui/package-lock.json
@@ -1,12 +1,12 @@
{
"name": "clerum-control-ui",
- "version": "0.1.683",
+ "version": "0.1.684",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"name": "clerum-control-ui",
- "version": "0.1.683",
+ "version": "0.1.684",
"dependencies": {
"@clerum/display-field": "file:../packages/display-field",
"@clerum/frontend-components": "file:../packages/frontend-components",
diff --git a/control-ui/package.json b/control-ui/package.json
index df360b0ce..07dc68703 100644
--- a/control-ui/package.json
+++ b/control-ui/package.json
@@ -1,6 +1,6 @@
{
"name": "clerum-control-ui",
- "version": "0.1.683",
+ "version": "0.1.684",
"private": true,
"scripts": {
"dev": "NEXT_IGNORE_INCORRECT_LOCKFILE=1 next dev",