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', () => {
|
it('prefers typed classification from GSDToolsError', () => {
|
||||||
const err = new GSDToolsError('x', 'state', ['load'], null, '', {
|
const err = GSDToolsError.timeout('x', 'state', ['load'], '', 2000);
|
||||||
classification: { kind: 'timeout', timeoutMs: 2000 },
|
|
||||||
});
|
|
||||||
expect(toFailureSignal(err)).toEqual({ kind: 'timeout', message: 'x', timeoutMs: 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({
|
await expect(adapter.dispatchJson('state', ['load'], 'state.load', [])).rejects.toMatchObject({
|
||||||
classification: { kind: 'failure' },
|
classification: GSDToolsError.failure('x', 'state', ['load'], 1).classification,
|
||||||
command: 'state',
|
command: 'state',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,9 +27,7 @@ describe('query dispatch error mapper', () => {
|
|||||||
|
|
||||||
it('maps typed timeout classification from GSDToolsError', () => {
|
it('maps typed timeout classification from GSDToolsError', () => {
|
||||||
const err = mapNativeDispatchError(
|
const err = mapNativeDispatchError(
|
||||||
new GSDToolsError('timeout', 'state', ['load'], null, '', {
|
GSDToolsError.timeout('timeout', 'state', ['load'], '', 1234),
|
||||||
classification: { kind: 'timeout', timeoutMs: 1234 },
|
|
||||||
}),
|
|
||||||
'state.load',
|
'state.load',
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
@@ -39,9 +37,7 @@ describe('query dispatch error mapper', () => {
|
|||||||
|
|
||||||
it('maps typed failure classification from GSDToolsError', () => {
|
it('maps typed failure classification from GSDToolsError', () => {
|
||||||
const err = mapNativeDispatchError(
|
const err = mapNativeDispatchError(
|
||||||
new GSDToolsError('boom', 'state', ['load'], 1, '', {
|
GSDToolsError.failure('boom', 'state', ['load'], 1),
|
||||||
classification: { kind: 'failure' },
|
|
||||||
}),
|
|
||||||
'state.load',
|
'state.load',
|
||||||
[],
|
[],
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user