mirror of
https://github.com/NanmiCoder/cc-haha
synced 2026-07-16 13:03:31 +08:00
The contributor PR adds useful Windows terminal and portable mode support, but it also reintroduced an older General settings zoom block and left the new native settings paths without enough regression coverage. This commit keeps the feature direction intact while removing the duplicate UI, making invalid bash paths fail at save time, and covering the portable cache and app-mode paths with focused tests. Constraint: This commit lands directly on the contributor PR branch to avoid a long review-comment loop. Rejected: Ask the contributor to rework the PR from scratch | the remaining issues are narrow and maintainable by us. Confidence: high Scope-risk: moderate Directive: Keep future portable-mode changes covered at the native boundary and the desktop store boundary. Tested: cd desktop && bun run test src/pages/TerminalSettings.test.tsx src/__tests__/generalSettings.test.tsx src/stores/settingsStore.test.ts Tested: bun test src/utils/__tests__/cachePaths.test.ts Tested: cd desktop/src-tauri && cargo test Tested: cd desktop && bun run lint Tested: cd desktop/src-tauri && cargo check Tested: bun run check:server Tested: bun run check:desktop Not-tested: Manual Windows packaged-app portable-mode smoke; to be covered before a future release.
27 lines
1002 B
TypeScript
27 lines
1002 B
TypeScript
import { afterEach, describe, expect, test } from 'bun:test'
|
|
import { join } from 'path'
|
|
import { tmpdir } from 'os'
|
|
import { CACHE_PATHS } from '../cachePaths.js'
|
|
|
|
const originalClaudeConfigDir = process.env.CLAUDE_CONFIG_DIR
|
|
|
|
afterEach(() => {
|
|
if (originalClaudeConfigDir === undefined) {
|
|
delete process.env.CLAUDE_CONFIG_DIR
|
|
} else {
|
|
process.env.CLAUDE_CONFIG_DIR = originalClaudeConfigDir
|
|
}
|
|
})
|
|
|
|
describe('CACHE_PATHS portable mode', () => {
|
|
test('places logs under CLAUDE_CONFIG_DIR when portable mode is active', () => {
|
|
const configDir = join(tmpdir(), 'cc-haha-portable-cache')
|
|
process.env.CLAUDE_CONFIG_DIR = configDir
|
|
|
|
expect(CACHE_PATHS.baseLogs().startsWith(join(configDir, 'Cache'))).toBe(true)
|
|
expect(CACHE_PATHS.errors().startsWith(join(configDir, 'Cache'))).toBe(true)
|
|
expect(CACHE_PATHS.messages().startsWith(join(configDir, 'Cache'))).toBe(true)
|
|
expect(CACHE_PATHS.mcpLogs('test:server').startsWith(join(configDir, 'Cache'))).toBe(true)
|
|
})
|
|
})
|