Skip to content

Commit 211ae90

Browse files
BearmancerUbuntu
authored andcommitted
test(tui): remove fixed wait and redundant assertion in prompt model switch test
1 parent 8a517fb commit 211ae90

1 file changed

Lines changed: 4 additions & 9 deletions

File tree

‎packages/tui/test/prompt-model-switch.test.tsx‎

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -76,20 +76,15 @@ test("a model switch waits for the server to know the session it targets", async
7676
// the create request is still in flight.
7777
setup.mockInput.pressEnter()
7878

79-
// The server rejects a model switch for a session it has not stored yet, so
80-
// the switch may not leave before the create was answered.
81-
const early = await Promise.race([
82-
switched.promise,
83-
new Promise<undefined>((resolve) => setTimeout(() => resolve(undefined), 2000)),
84-
])
79+
// Wait for the empty Enter to be processed by the composer before releasing
80+
// the held session creation.
81+
await new Promise((resolve) => setTimeout(resolve, 50))
8582
create.resolve()
8683
const sent = await switched.promise
8784

88-
expect(early).toBeUndefined()
8985
// The switch carries the session id the client minted, unmodified.
9086
const createdID = created[0]?.id
9187
if (!createdID) throw new Error("the session was never created")
9288
expect(sent.id).toBe(createdID)
93-
expect(sent.id).not.toBe(sent.id.toUpperCase())
9489
expect(sent.createAnswered).toBe(true)
95-
})
90+
}, 15000)

0 commit comments

Comments
 (0)