Files
msd-core/sdk/src/query/command-topology.test.ts
Tom Boucher 5e21bf7567 Deepen query dispatch seam with Command Topology Module (#3078)
* Deepen query dispatch seam with command topology module

* Stabilize SDK parity defaults and integration test gating

* docs(architecture): record pre-project config policy and e2e gate

* refactor(query): stop injecting native adapter in CLI dispatch path

* fix(config): align workflow auto-chain typing and docs
2026-05-03 18:11:38 -04:00

29 lines
1.0 KiB
TypeScript

import { describe, it, expect } from 'vitest';
import { createRegistry } from './index.js';
import { createCommandTopology } from './command-topology.js';
describe('command-topology', () => {
it('resolves native command with adapter', () => {
const registry = createRegistry();
const topology = createCommandTopology(registry);
const out = topology.resolve(['state', 'json']);
expect(out.kind).toBe('match');
if (out.kind !== 'match') throw new Error('expected match');
expect(out.canonical).toBe('state.json');
expect(out.args).toEqual([]);
expect(typeof out.adapter).toBe('function');
});
it('returns no_match with diagnosis', () => {
const registry = createRegistry();
const topology = createCommandTopology(registry);
const out = topology.resolve(['unknown-cmd'], true);
expect(out.kind).toBe('no_match');
if (out.kind !== 'no_match') throw new Error('expected no_match');
expect(out.message).toContain('Unknown command');
expect(out.attempted.length).toBeGreaterThanOrEqual(0);
});
});