refactor(query): deepen command/dispatch seams and resolve coderabbit findings
* refactor(query): deepen command definition seam and fold fallback mapping cleanup * refactor(query): add shared dispatch formatting module seam * fix(query): restore QueryResult type import in dispatch deps * test/query: align raw-output policy and definition normalization contracts * refactor(query): deepen diagnosis, invariant report, and error taxonomy seams * refactor(query): deepen dispatch plan, fallback bridge, policy snapshot, and hints seams * refactor(query): deepen validation, fallback policy, capability, and result builder seams * refactor(query): deepen resolution strategy, output classifier, observability, and policy-capability seams * refactor(query): finalize deep strategy/classifier/observability/capability seams * test/query: address coderabbit inline and out-of-diff dispatch nits * fix(query): address remaining coderabbit input-validation and bridge stderr threads * fix(query): address remaining coderabbit dispatch and strategy/output nits
This commit is contained in:
28
sdk/src/query/query-dispatch-formatting.test.ts
Normal file
28
sdk/src/query/query-dispatch-formatting.test.ts
Normal file
@@ -0,0 +1,28 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
import { formatPick, formatSuccess } from './query-dispatch-formatting.js';
|
||||
|
||||
describe('query-dispatch-formatting', () => {
|
||||
it('formats text with trailing newline', () => {
|
||||
expect(formatSuccess('USAGE', 'text')).toBe('USAGE\n');
|
||||
});
|
||||
|
||||
it('formats json with pretty printing', () => {
|
||||
expect(formatSuccess({ nested: { value: 3 } }, 'json')).toBe([
|
||||
'{',
|
||||
' "nested": {',
|
||||
' "value": 3',
|
||||
' }',
|
||||
'}',
|
||||
'',
|
||||
].join('\n'));
|
||||
});
|
||||
|
||||
it('formats json and applies pick', () => {
|
||||
expect(formatSuccess({ nested: { value: 3 } }, 'json', 'nested.value')).toBe('3\n');
|
||||
});
|
||||
|
||||
it('formatPick returns input when no pickField', () => {
|
||||
const input = { ok: true };
|
||||
expect(formatPick(input)).toBe(input);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user