From 23d6756f0370284377cda080036ed4dd456d9a9d Mon Sep 17 00:00:00 2001 From: Stephan Rieche Date: Sat, 27 Dec 2025 13:20:39 +0100 Subject: [PATCH] test: fix sandbox mode test assertions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Add comprehensive test coverage for sandbox mode configuration: - Added tests for enableSandboxMode=false for both createChatOptions and createAutoModeOptions - Added tests for enableSandboxMode not provided for both functions - Updated existing tests to pass enableSandboxMode=true where sandbox assertions exist This addresses the broken test assertions identified by coderabbit-ai review. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- .../server/tests/unit/lib/sdk-options.test.ts | 46 ++++++++++++++++++- 1 file changed, 44 insertions(+), 2 deletions(-) diff --git a/apps/server/tests/unit/lib/sdk-options.test.ts b/apps/server/tests/unit/lib/sdk-options.test.ts index c7324d6c..e5d4c7c0 100644 --- a/apps/server/tests/unit/lib/sdk-options.test.ts +++ b/apps/server/tests/unit/lib/sdk-options.test.ts @@ -179,7 +179,7 @@ describe('sdk-options.ts', () => { it('should create options with chat settings', async () => { const { createChatOptions, TOOL_PRESETS, MAX_TURNS } = await import('@/lib/sdk-options.js'); - const options = createChatOptions({ cwd: '/test/path' }); + const options = createChatOptions({ cwd: '/test/path', enableSandboxMode: true }); expect(options.cwd).toBe('/test/path'); expect(options.maxTurns).toBe(MAX_TURNS.standard); @@ -212,6 +212,27 @@ describe('sdk-options.ts', () => { expect(options.model).toBe('claude-sonnet-4-20250514'); }); + + it('should not set sandbox when enableSandboxMode is false', async () => { + const { createChatOptions } = await import('@/lib/sdk-options.js'); + + const options = createChatOptions({ + cwd: '/test/path', + enableSandboxMode: false, + }); + + expect(options.sandbox).toBeUndefined(); + }); + + it('should not set sandbox when enableSandboxMode is not provided', async () => { + const { createChatOptions } = await import('@/lib/sdk-options.js'); + + const options = createChatOptions({ + cwd: '/test/path', + }); + + expect(options.sandbox).toBeUndefined(); + }); }); describe('createAutoModeOptions', () => { @@ -219,7 +240,7 @@ describe('sdk-options.ts', () => { const { createAutoModeOptions, TOOL_PRESETS, MAX_TURNS } = await import('@/lib/sdk-options.js'); - const options = createAutoModeOptions({ cwd: '/test/path' }); + const options = createAutoModeOptions({ cwd: '/test/path', enableSandboxMode: true }); expect(options.cwd).toBe('/test/path'); expect(options.maxTurns).toBe(MAX_TURNS.maximum); @@ -252,6 +273,27 @@ describe('sdk-options.ts', () => { expect(options.abortController).toBe(abortController); }); + + it('should not set sandbox when enableSandboxMode is false', async () => { + const { createAutoModeOptions } = await import('@/lib/sdk-options.js'); + + const options = createAutoModeOptions({ + cwd: '/test/path', + enableSandboxMode: false, + }); + + expect(options.sandbox).toBeUndefined(); + }); + + it('should not set sandbox when enableSandboxMode is not provided', async () => { + const { createAutoModeOptions } = await import('@/lib/sdk-options.js'); + + const options = createAutoModeOptions({ + cwd: '/test/path', + }); + + expect(options.sandbox).toBeUndefined(); + }); }); describe('createCustomOptions', () => {