mirror of
https://github.com/thedotmack/claude-mem.git
synced 2026-09-20 04:23:02 +08:00
2a0a407340
Cuts verified dead code, duplication, and speculative abstractions across 14 disjoint areas of the tree: sqlite layer, worker HTTP routes, search pipeline, server, chroma sync, viewer UI, npx-cli, MCP server, shared/utils, telemetry/infra, integrations, scripts, tests, and stale plans/evals docs. Also unifies the Chroma search pipeline onto SearchOrchestrator/strategies and ports dual-project (merged_into_project) scoping plus dateRange filtering into ChromaSearchStrategy, which corpus builds need but had silently lost. Full audit trail: 65-agent verification workflow wf_160a7862-1a6, 14-agent execution wf_c7e48c0f-164, 6-agent fixup wf_865f86a4-c6b. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
91 lines
2.4 KiB
TypeScript
91 lines
2.4 KiB
TypeScript
import { describe, it, expect, beforeEach, afterEach } from 'bun:test';
|
|
import { HOOK_TIMEOUTS, HOOK_EXIT_CODES, getTimeout } from '../src/shared/hook-constants.js';
|
|
|
|
describe('hook-constants', () => {
|
|
const originalPlatform = process.platform;
|
|
|
|
afterEach(() => {
|
|
Object.defineProperty(process, 'platform', {
|
|
value: originalPlatform,
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
});
|
|
|
|
describe('HOOK_TIMEOUTS', () => {
|
|
it('should define HEALTH_CHECK timeout as 3s (reduced from 30s)', () => {
|
|
expect(HOOK_TIMEOUTS.HEALTH_CHECK).toBe(3000);
|
|
});
|
|
|
|
it('should define POST_SPAWN_WAIT as 15s', () => {
|
|
expect(HOOK_TIMEOUTS.POST_SPAWN_WAIT).toBe(15000);
|
|
});
|
|
|
|
it('should define PORT_IN_USE_WAIT as 3s', () => {
|
|
expect(HOOK_TIMEOUTS.PORT_IN_USE_WAIT).toBe(3000);
|
|
});
|
|
|
|
it('should define WINDOWS_MULTIPLIER', () => {
|
|
expect(HOOK_TIMEOUTS.WINDOWS_MULTIPLIER).toBe(1.5);
|
|
});
|
|
|
|
it('should define POWERSHELL_COMMAND timeout as 10000ms', () => {
|
|
expect(HOOK_TIMEOUTS.POWERSHELL_COMMAND).toBe(10000);
|
|
});
|
|
});
|
|
|
|
describe('HOOK_EXIT_CODES', () => {
|
|
it('should define SUCCESS exit code', () => {
|
|
expect(HOOK_EXIT_CODES.SUCCESS).toBe(0);
|
|
});
|
|
|
|
it('should define BLOCKING_ERROR exit code', () => {
|
|
expect(HOOK_EXIT_CODES.BLOCKING_ERROR).toBe(2);
|
|
});
|
|
});
|
|
|
|
describe('getTimeout', () => {
|
|
it('should return base timeout on non-Windows platforms', () => {
|
|
Object.defineProperty(process, 'platform', {
|
|
value: 'darwin',
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
|
|
expect(getTimeout(1000)).toBe(1000);
|
|
expect(getTimeout(5000)).toBe(5000);
|
|
});
|
|
|
|
it('should apply Windows multiplier on Windows platform', () => {
|
|
Object.defineProperty(process, 'platform', {
|
|
value: 'win32',
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
|
|
expect(getTimeout(1000)).toBe(1500);
|
|
expect(getTimeout(2000)).toBe(3000);
|
|
});
|
|
|
|
it('should round Windows timeout to nearest integer', () => {
|
|
Object.defineProperty(process, 'platform', {
|
|
value: 'win32',
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
|
|
expect(getTimeout(333)).toBe(500);
|
|
});
|
|
|
|
it('should return base timeout on Linux', () => {
|
|
Object.defineProperty(process, 'platform', {
|
|
value: 'linux',
|
|
writable: true,
|
|
configurable: true
|
|
});
|
|
|
|
expect(getTimeout(1000)).toBe(1000);
|
|
});
|
|
});
|
|
});
|