gitgram/aitimemachine/gitnexus/test/unit/doctor-format.test.ts
caelum0x 49b183818c Unify gitgram + aitimemachine into the monorepo (de-submodule) and merge vendored engines
Convert gitgram/ and aitimemachine/ from embedded git repos (which showed as
opaque submodule gitlinks on GitHub) into fully-tracked first-party content.

AITM now merges its 7 vendored repos as first-party engines:
- memory: beads (Go task DAG) + context7 (docs SDK), unified into saved_contexts
- git: vendored C git (bundled binary) + gitnexus (in-process code intelligence)
- agentic: a2a (@a2a-js/sdk) + pal (AITM-managed Python subprocess)

Includes the full session's product build: Gitgram web/mobile/backend features,
AITM website/CLI/MCP, the unified memory layer, engine build tooling
(scripts/build-engines.sh, Dockerfile, CI), docs (README, ENGINES.md, ARCHITECTURE.md),
and extensive test suites.

Build artifacts, node_modules, external/, and gemini-cli are gitignored.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-23 14:14:09 +03:00

58 lines
2.0 KiB
TypeScript

import { describe, expect, it } from 'vitest';
import { displayWidth, localEmbeddingDoctorStatus, padDisplayEnd } from '../../src/cli/doctor.js';
describe('doctor output formatting', () => {
it('keeps ASCII padding equivalent to String.padEnd', () => {
expect(displayWidth('OS:')).toBe(3);
expect(padDisplayEnd('OS:', 10)).toBe('OS:'.padEnd(10));
});
it('pads CJK labels by terminal display width, not code-unit length', () => {
const padded = padDisplayEnd('系统:', 10);
expect(displayWidth('系统:')).toBe(6);
expect(displayWidth(padded)).toBe(10);
expect(padded).toBe('系统: ');
});
it('does not truncate labels that are already wider than the target width', () => {
expect(padDisplayEnd('图存储:', 4)).toBe('图存储:');
});
});
describe('doctor embedding-runtime support status', () => {
it('flags local embeddings as unavailable on macOS Intel (darwin/x64)', () => {
const { status, detail } = localEmbeddingDoctorStatus({
httpMode: false,
platform: 'darwin',
arch: 'x64',
});
expect(status).toBe('✗ local embeddings unavailable on darwin/x64');
expect(detail).not.toBeNull();
expect(detail).toMatch(/macOS Intel/);
expect(detail).toMatch(/native binding/i);
});
it('reports local embeddings as supported on darwin/arm64, linux/x64, and win32/x64', () => {
for (const [platform, arch] of [
['darwin', 'arm64'],
['linux', 'x64'],
['win32', 'x64'],
] as Array<[NodeJS.Platform, NodeJS.Architecture]>) {
const { status, detail } = localEmbeddingDoctorStatus({ httpMode: false, platform, arch });
expect(status).toBe('✓ local embeddings supported');
expect(detail).toBeNull();
}
});
it('reports HTTP backend as configured and never blocks on platform', () => {
const { status, detail } = localEmbeddingDoctorStatus({
httpMode: true,
platform: 'darwin',
arch: 'x64',
});
expect(status).toBe('✓ http endpoint configured');
expect(detail).toBeNull();
});
});