test: adopt typed GSDToolsError constructors across failure tests

This commit is contained in:
Tom Boucher
2026-05-04 20:09:48 -04:00
parent 9a469fa05c
commit 9bee4dce4a
3 changed files with 4 additions and 10 deletions

View File

@@ -21,9 +21,7 @@ describe('query failure classification', () => {
});
it('prefers typed classification from GSDToolsError', () => {
const err = new GSDToolsError('x', 'state', ['load'], null, '', {
classification: { kind: 'timeout', timeoutMs: 2000 },
});
const err = GSDToolsError.timeout('x', 'state', ['load'], '', 2000);
expect(toFailureSignal(err)).toEqual({ kind: 'timeout', message: 'x', timeoutMs: 2000 });
});
});

View File

@@ -14,7 +14,7 @@ describe('QueryNativeDirectAdapter', () => {
});
await expect(adapter.dispatchJson('state', ['load'], 'state.load', [])).rejects.toMatchObject({
classification: { kind: 'failure' },
classification: GSDToolsError.failure('x', 'state', ['load'], 1).classification,
command: 'state',
});
});

View File

@@ -27,9 +27,7 @@ describe('query dispatch error mapper', () => {
it('maps typed timeout classification from GSDToolsError', () => {
const err = mapNativeDispatchError(
new GSDToolsError('timeout', 'state', ['load'], null, '', {
classification: { kind: 'timeout', timeoutMs: 1234 },
}),
GSDToolsError.timeout('timeout', 'state', ['load'], '', 1234),
'state.load',
[],
);
@@ -39,9 +37,7 @@ describe('query dispatch error mapper', () => {
it('maps typed failure classification from GSDToolsError', () => {
const err = mapNativeDispatchError(
new GSDToolsError('boom', 'state', ['load'], 1, '', {
classification: { kind: 'failure' },
}),
GSDToolsError.failure('boom', 'state', ['load'], 1),
'state.load',
[],
);