Skip to content

Commit 242e418

Browse files
committed
test(computer-use): check trimmed confirmation values on their own
1 parent 47ecb4f commit 242e418

1 file changed

Lines changed: 11 additions & 7 deletions

File tree

‎apps/desktop/src/main/computer-use/service.test.ts‎

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,13 +137,6 @@ describe('native computer use authority and lifecycle', () => {
137137
})
138138
expect(native.request.mock.calls.map(([method]) => method)).not.toContain('app_command')
139139
expect(confirmAppCommand.mock.calls[0]?.[0].summary).toContain('Priority: High')
140-
await expect(
141-
service.execute('padded', 'chat', {
142-
action: 'app_command',
143-
command: { name: 'create_reminder', title: ' Pay rent ' },
144-
})
145-
).resolves.toMatchObject({ kind: 'command' })
146-
expect(confirmAppCommand.mock.calls[1]?.[0].summary.split('\n')[0]).toBe('Reminder: Pay rent')
147140

148141
await expect(service.execute('confirmed', 'chat', create)).resolves.toMatchObject({
149142
kind: 'command',
@@ -173,6 +166,17 @@ describe('native computer use authority and lifecycle', () => {
173166
expect(native.request.mock.calls.map(([method]) => method)).not.toContain('app_command')
174167
})
175168

169+
it('shows the trimmed values the helper will save', async () => {
170+
const { service, confirmAppCommand } = setup()
171+
await service.execute('padded', 'chat', {
172+
action: 'app_command',
173+
command: { name: 'create_reminder', title: ' Pay rent ', notes: '\tBy Friday ' },
174+
})
175+
expect(confirmAppCommand.mock.calls[0]?.[0].summary).toBe(
176+
'Reminder: Pay rent\nList: default\nNotes: By Friday'
177+
)
178+
})
179+
176180
it('refuses an app command when the user denies the app, before asking to confirm', async () => {
177181
const { service, native, approveApp, confirmAppCommand } = setup()
178182
approveApp.mockResolvedValue('deny')

0 commit comments

Comments
 (0)