test(desktop): cover the inline command expander on the approval bar

Asserts the full command is absent until the Command toggle is clicked, then
rendered in full — guarding the long-command reveal path.
This commit is contained in:
xxxigm 2026-06-12 18:27:14 +07:00 committed by Teknium
parent 266b5a19f1
commit 5d6c16e972

View file

@ -84,6 +84,19 @@ describe('PendingToolApproval', () => {
expect($approvalRequest.get()).toBeNull()
})
it('reveals the full command inline when the Command toggle is clicked', () => {
const longCommand = 'python -c "' + 'x'.repeat(400) + '"'
setRequest(longCommand)
render(<PendingToolApproval part={part('terminal')} />)
// Collapsed by default: the full command is not in the DOM yet.
expect(screen.queryByText(longCommand)).toBeNull()
fireEvent.click(screen.getByRole('button', { name: /Command/ }))
expect(screen.getByText(longCommand)).toBeTruthy()
})
it('sends choice "deny" on Reject', async () => {
const request = mockGateway()
setRequest()