Skip to content

Commit 425b462

Browse files
committed
test(session): cover delete attached session with force
1 parent 11a4d71 commit 425b462

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

src/tests/tools/session/session.test.ts

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,9 +256,25 @@ describe('appium_session_management tool', () => {
256256

257257
expect(result.isError).toBe(true);
258258
expect(result.content[0].text).toContain('action=detach');
259+
expect(result.content[0].text).toContain('force=true');
259260
expect(mockSafeDeleteSession).not.toHaveBeenCalled();
260261
});
261262

263+
test('deletes attached session when force is true', async () => {
264+
const tool = await getToolExecute();
265+
mockGetSessionOwnership.mockReturnValue('attached');
266+
mockSafeDeleteSession.mockResolvedValue(true as any);
267+
268+
const result = await tool.execute(
269+
{ action: 'delete', sessionId: 'borrowed', force: true },
270+
undefined
271+
);
272+
273+
expect(result.isError).toBeFalsy();
274+
expect(result.content[0].text).toContain('deleted successfully');
275+
expect(mockSafeDeleteSession).toHaveBeenCalledWith('borrowed');
276+
});
277+
262278
test('reports not found when session does not exist', async () => {
263279
const tool = await getToolExecute();
264280
mockGetSessionOwnership.mockReturnValue(null);

0 commit comments

Comments
 (0)