diff --git a/sdk/src/query-native-hotpath-adapter.test.ts b/sdk/src/query-native-hotpath-adapter.test.ts index bdd6c672f..727494d4d 100644 --- a/sdk/src/query-native-hotpath-adapter.test.ts +++ b/sdk/src/query-native-hotpath-adapter.test.ts @@ -17,8 +17,8 @@ describe('QueryNativeHotpathAdapter', () => { await expect(adapter.dispatch('state', ['load'], 'state.load', [], 'json')).resolves.toEqual({ ok: true }); await expect(adapter.dispatch('commit', ['m'], 'commit', ['m'], 'raw')).resolves.toEqual('ok'); - expect((native as { dispatchJson: ReturnType }).dispatchJson).toHaveBeenCalledTimes(1); - expect((native as { dispatchRaw: ReturnType }).dispatchRaw).toHaveBeenCalledTimes(1); + expect((native as { dispatchJson: ReturnType }).dispatchJson).toHaveBeenCalledWith('state', ['load'], 'state.load', []); + expect((native as { dispatchRaw: ReturnType }).dispatchRaw).toHaveBeenCalledWith('commit', ['m'], 'commit', ['m']); }); it('uses fallback when native query disabled', async () => { @@ -37,7 +37,7 @@ describe('QueryNativeHotpathAdapter', () => { await expect(adapter.dispatch('state', ['load'], 'state.load', [], 'json')).resolves.toEqual({ from: 'fallback-json' }); await expect(adapter.dispatch('commit', ['m'], 'commit', ['m'], 'raw')).resolves.toEqual('fallback-raw'); - expect(execJsonFallback).toHaveBeenCalledTimes(1); - expect(execRawFallback).toHaveBeenCalledTimes(1); + expect(execJsonFallback).toHaveBeenCalledWith('state', ['load']); + expect(execRawFallback).toHaveBeenCalledWith('commit', ['m']); }); }); diff --git a/sdk/src/query-raw-output-projection.test.ts b/sdk/src/query-raw-output-projection.test.ts index d2dcc96de..4b7db4e85 100644 --- a/sdk/src/query-raw-output-projection.test.ts +++ b/sdk/src/query-raw-output-projection.test.ts @@ -6,6 +6,18 @@ describe('formatQueryRawOutput', () => { expect(formatQueryRawOutput('commit', { committed: true, hash: 'abc123' })).toBe('abc123'); }); + it('returns committed when hash missing', () => { + expect(formatQueryRawOutput('commit', { committed: true })).toBe('committed'); + }); + + it('formats skipped commit reason', () => { + expect(formatQueryRawOutput('commit', { committed: false, reason: 'skipped' })).toBe('skipped'); + }); + + it('formats nothing-to-commit reason', () => { + expect(formatQueryRawOutput('commit', { committed: false, reason: 'nothing_to_commit' })).toBe('nothing'); + }); + it('formats config-set key=value', () => { expect(formatQueryRawOutput('config-set', { updated: true, key: 'mode', value: 'yolo' })).toBe('mode=yolo'); }); @@ -14,4 +26,9 @@ describe('formatQueryRawOutput', () => { expect(formatQueryRawOutput('state.begin-phase', { updated: ['x'] })).toBe('true'); expect(formatQueryRawOutput('state.begin-phase', { updated: [] })).toBe('false'); }); + + it('formats state begin-phase alias', () => { + expect(formatQueryRawOutput('state begin-phase', { updated: ['x'] })).toBe('true'); + expect(formatQueryRawOutput('state begin-phase', { updated: [] })).toBe('false'); + }); });