mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-12 06:12:18 +00:00
style(voice): apply exact Prettier 3.9.6 output to #835
Restore unchanged formatter script after ephemeral CI verification. Keep current-main-compatible reason instrumentation, pointer crop and capture cancellation tests.
This commit is contained in:
1 parent
d4980b1b77
commit
cb3b66e38b
3 files changed
+30
-27
No files matched your search
@@ -141,18 +141,6 @@ if (import.meta.url === invoked) {
|
|||||||
if (mode === '--check' && result.changed.length) {
|
if (mode === '--check' && result.changed.length) {
|
||||||
for (const name of result.changed)
|
for (const name of result.changed)
|
||||||
console.error(`Needs formatting: ${name}`);
|
console.error(`Needs formatting: ${name}`);
|
||||||
// Temporary CI-only formatter diagnostic. This commit is never promoted.
|
|
||||||
for (const name of result.changed.filter((file) =>
|
|
||||||
['src/voice/realtimeViewport.js', 'src/voice/realtimeViewportPolicy.test.mjs'].includes(file)
|
|
||||||
)) {
|
|
||||||
const file = path.join(fileURLToPath(new URL('../', import.meta.url)), name);
|
|
||||||
const output = await prettier.format(await readFile(file, 'utf8'), {
|
|
||||||
...(await prettier.resolveConfig(file)), filepath: file,
|
|
||||||
});
|
|
||||||
const encoded = Buffer.from(output).toString('base64');
|
|
||||||
for (let pos = 0; pos < encoded.length; pos += 1000)
|
|
||||||
console.error(`PRETTIER-DATA|${name}|${pos}|${encoded.slice(pos, pos + 1000)}`);
|
|
||||||
}
|
|
||||||
process.exitCode = 1;
|
process.exitCode = 1;
|
||||||
} else {
|
} else {
|
||||||
console.log(
|
console.log(
|
||||||
|
|||||||
@@ -112,7 +112,6 @@ export function viewportContextDecision(result, { channelOpen = true } = {}) {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Square source rectangle around a canvas point, clamped inside the canvas,
|
* Square source rectangle around a canvas point, clamped inside the canvas,
|
||||||
* in drawing-buffer pixels, plus where the point lands in the output image.
|
* in drawing-buffer pixels, plus where the point lands in the output image.
|
||||||
|
|||||||
@@ -1,7 +1,10 @@
|
|||||||
import assert from 'node:assert/strict';
|
import assert from 'node:assert/strict';
|
||||||
import test from 'node:test';
|
import test from 'node:test';
|
||||||
|
|
||||||
import { RealtimeViewport, viewportContextDecision } from './realtimeViewport.js';
|
import {
|
||||||
|
RealtimeViewport,
|
||||||
|
viewportContextDecision,
|
||||||
|
} from './realtimeViewport.js';
|
||||||
|
|
||||||
const localContext = (overrides = {}) => ({
|
const localContext = (overrides = {}) => ({
|
||||||
action: 'get_entity_context',
|
action: 'get_entity_context',
|
||||||
@@ -99,7 +102,10 @@ test('pointer ground selects the #837 crop path, not a full viewport', () => {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
viewportContextDecision({ ...pointerContext, selected: { id: 'building' } }),
|
viewportContextDecision({
|
||||||
|
...pointerContext,
|
||||||
|
selected: { id: 'building' },
|
||||||
|
}),
|
||||||
{
|
{
|
||||||
send: false,
|
send: false,
|
||||||
reason: 'pointer-identity-present',
|
reason: 'pointer-identity-present',
|
||||||
@@ -144,8 +150,14 @@ test('runtime dispatch preserves pointer crop and full image separation', async
|
|||||||
true,
|
true,
|
||||||
);
|
);
|
||||||
assert.equal(calls.filter((call) => call.kind === 'crop').length, 1);
|
assert.equal(calls.filter((call) => call.kind === 'crop').length, 1);
|
||||||
assert.deepEqual(calls.find((call) => call.kind === 'crop').snapshot, pointer);
|
assert.deepEqual(
|
||||||
assert.equal(calls.find((call) => call.kind === 'crop').options.viewScale, 'city');
|
calls.find((call) => call.kind === 'crop').snapshot,
|
||||||
|
pointer,
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
calls.find((call) => call.kind === 'crop').options.viewScale,
|
||||||
|
'city',
|
||||||
|
);
|
||||||
assert.equal(calls.filter((call) => call.kind === 'viewport').length, 0);
|
assert.equal(calls.filter((call) => call.kind === 'viewport').length, 0);
|
||||||
|
|
||||||
assert.equal(await viewport.sendVisualContextIfUseful(localContext()), true);
|
assert.equal(await viewport.sendVisualContextIfUseful(localContext()), true);
|
||||||
@@ -157,10 +169,13 @@ test('runtime dispatch preserves pointer crop and full image separation', async
|
|||||||
false,
|
false,
|
||||||
);
|
);
|
||||||
assert.equal(calls.filter((call) => call.kind === 'viewport').length, 1);
|
assert.equal(calls.filter((call) => call.kind === 'viewport').length, 1);
|
||||||
assert.ok(calls.some((call) =>
|
assert.ok(
|
||||||
call.event === 'viewport_context.decision' &&
|
calls.some(
|
||||||
call.detail.reason === 'pointer-ground-crop'
|
(call) =>
|
||||||
));
|
call.event === 'viewport_context.decision' &&
|
||||||
|
call.detail.reason === 'pointer-ground-crop',
|
||||||
|
),
|
||||||
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('closed channel never captures pointer or full viewport', async () => {
|
test('closed channel never captures pointer or full viewport', async () => {
|
||||||
@@ -232,11 +247,12 @@ test('successful retained send is logged without recording image contents', asyn
|
|||||||
capture: async () => 'data:image/jpeg;base64,AA==',
|
capture: async () => 'data:image/jpeg;base64,AA==',
|
||||||
});
|
});
|
||||||
assert.equal(await viewport.sendVisualContextIfUseful(localContext()), true);
|
assert.equal(await viewport.sendVisualContextIfUseful(localContext()), true);
|
||||||
assert.ok(diagnostics.some((item) =>
|
assert.ok(
|
||||||
item.event === 'viewport_context.result' && item.detail.reason === 'sent'
|
diagnostics.some(
|
||||||
));
|
(item) =>
|
||||||
assert.equal(
|
item.event === 'viewport_context.result' &&
|
||||||
JSON.stringify(diagnostics).includes('data:image/jpeg'),
|
item.detail.reason === 'sent',
|
||||||
false,
|
),
|
||||||
);
|
);
|
||||||
|
assert.equal(JSON.stringify(diagnostics).includes('data:image/jpeg'), false);
|
||||||
});
|
});
|
||||||
Reference in new issue
Block a user