Files
thedotmack__claude-mem/tests/worker/agents/fallback-error-handler.test.ts
Alex Newman 2a0a407340 chore: remove over-engineering findings from repo-wide ponytail audit (wave 1)
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>
2026-07-02 20:49:27 -07:00

43 lines
1.5 KiB
TypeScript

import { describe, it, expect } from 'bun:test';
import { isAbortError } from '../../../src/services/worker/agents/FallbackErrorHandler.js';
describe('FallbackErrorHandler', () => {
describe('isAbortError', () => {
it('should return true for Error with name "AbortError"', () => {
const abortError = new Error('The operation was aborted');
abortError.name = 'AbortError';
expect(isAbortError(abortError)).toBe(true);
});
it('should return true for objects with name "AbortError"', () => {
expect(isAbortError({ name: 'AbortError', message: 'aborted' })).toBe(true);
});
it('should return false for regular Error objects', () => {
expect(isAbortError(new Error('Some error'))).toBe(false);
expect(isAbortError(new TypeError('Type error'))).toBe(false);
});
it('should return false for errors with other names', () => {
const error = new Error('timeout');
error.name = 'TimeoutError';
expect(isAbortError(error)).toBe(false);
});
it('should return false for null and undefined', () => {
expect(isAbortError(null)).toBe(false);
expect(isAbortError(undefined)).toBe(false);
});
it('should return false for strings', () => {
expect(isAbortError('AbortError')).toBe(false);
});
it('should return false for objects without name property', () => {
expect(isAbortError({ message: 'error' })).toBe(false);
expect(isAbortError({})).toBe(false);
});
});
});