Jelajahi Sumber

test: await exact stdio startup condition

Tianyi Cui 2 bulan lalu
induk
melakukan
656ae95263
1 mengubah file dengan 2 tambahan dan 3 penghapusan
  1. 2 3
      packages/ui/stdio-agent/tests/stdio-agent.spec.ts

+ 2 - 3
packages/ui/stdio-agent/tests/stdio-agent.spec.ts

@@ -114,9 +114,8 @@ describe('dsh-stdio-agent app', () => {
     const ctx = new Context()
     const ctx = new Context()
     // No persona: covers the omitted-persona forwarding branch too.
     // No persona: covers the omitted-persona forwarding branch too.
     stdioAgent.apply(ctx, { model: 'mock', skills: await isolatedSkillsConfig() })
     stdioAgent.apply(ctx, { model: 'mock', skills: await isolatedSkillsConfig() })
-    await new Promise(resolve => setTimeout(resolve, 80))
-    expect(ctx.get('sessionPersistence')).toBeDefined()
-    expect(ctx.get('agents')?.list()).toHaveLength(1)
+    await expect.poll(() => ctx.get('sessionPersistence')).toBeDefined()
+    await expect.poll(() => ctx.get('agents')?.list()).toHaveLength(1)
     await ctx.fiber.dispose()
     await ctx.fiber.dispose()
   })
   })