test(tui): wait for scoped file completion

The fake terminal retains earlier autocomplete frames, so the directory follow-up assertion could pass before the scoped lookup completed. Wait for the quoted file mention to be applied before submitting.
This commit is contained in:
Tianyi Cui
2026-07-24 19:38:31 +08:00
parent 1731243fa0
commit 51f697db50
+4 -3
View File
@@ -1914,10 +1914,11 @@ describe('pi-tui chat lifecycle and transcript', () => {
expect(result.terminal.output).toContain('Folder · docs/')
})
result.terminal.send('\t')
await vi.waitFor(() => {
expect(result.terminal.output).toContain('File · design notes.md')
})
result.terminal.output = ''
result.terminal.send('\t')
await vi.waitFor(() => {
expect(result.terminal.output).toContain('@"docs/design notes.md"')
})
await tick()
result.terminal.send('\r')
await vi.waitFor(() => { expect(result.agent.sent).toHaveLength(2) })