test: adopt typed GSDToolsError constructors across failure tests
This commit is contained in:
@@ -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 });
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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',
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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',
|
||||
[],
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user