mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-14 15:22:21 +00:00
test(voice): pin crop-capture throws and defensive skips; tighten reason glosses
A throw from the crop capture now has a test that it closes its decision with an error outcome. Direct calls to the crop and image senders pin the channel-closed and pointer-scale-not-useful skips. The docs say a send decision requests an image, and when a pointer snapshot counts as already requested.
This commit is contained in:
1 parent
df37c9360d
commit
4384e0d402
2 files changed
+43
-1
No files matched your search
@@ -520,6 +520,15 @@ test('a step that throws still closes its decision, then rethrows', async () =>
|
||||
},
|
||||
},
|
||||
],
|
||||
[
|
||||
pointerGround(),
|
||||
{
|
||||
readPointer: () => groundSnapshot(),
|
||||
capturePointer: async () => {
|
||||
throw new Error('crop boom');
|
||||
},
|
||||
},
|
||||
],
|
||||
]) {
|
||||
const { viewport, events } = recordingViewport(extra);
|
||||
await assert.rejects(viewport.sendVisualContextIfUseful(context), /boom/);
|
||||
@@ -537,6 +546,39 @@ test('a step that throws still closes its decision, then rethrows', async () =>
|
||||
}
|
||||
});
|
||||
|
||||
test('direct calls log their defensive skips without a decision id', async () => {
|
||||
const open = recordingViewport();
|
||||
assert.equal(
|
||||
await open.viewport.sendPointerCrop(groundSnapshot(), {
|
||||
viewScale: 'global',
|
||||
}),
|
||||
false,
|
||||
);
|
||||
const closed = recordingViewport({ channel: { readyState: 'closed' } });
|
||||
assert.equal(
|
||||
await closed.viewport.sendPointerCrop(groundSnapshot(), {
|
||||
viewScale: 'city',
|
||||
}),
|
||||
false,
|
||||
);
|
||||
assert.equal(
|
||||
await closed.viewport.sendRetainedImage(
|
||||
async () => 'data:image/jpeg;base64,AA==',
|
||||
'text',
|
||||
'client.viewport_context',
|
||||
),
|
||||
false,
|
||||
);
|
||||
assert.deepEqual(
|
||||
[...open.events, ...closed.events].map((item) => item.detail),
|
||||
[
|
||||
{ contextId: null, kind: 'crop', reason: 'pointer-scale-not-useful' },
|
||||
{ contextId: null, kind: 'crop', reason: 'channel-closed' },
|
||||
{ contextId: null, kind: 'viewport', reason: 'channel-closed' },
|
||||
],
|
||||
);
|
||||
});
|
||||
|
||||
test('a throw after a real send still logs it as sent', async () => {
|
||||
let reads = 0;
|
||||
const { viewport, events } = recordingViewport({
|
||||
|
||||
Reference in new issue
Block a user