Files
gods-eye-view/src/voice/realtimeCostIncompleteNote.i18n.test.mjs
T
Sameh Khamis 1de4f635ca feat(voice): render the voice control from a presenter
createVoiceControl now returns a presenter instead of building the
control with innerHTML: the session, cost, input, card and panel owners
write its state by part and listen for interactions, and VoiceControl.vue
renders it in the command dock, between the location bar and the visual
presets as before. Focus moves wait for the render; the waveform's bars
publish apart from the control and only when they change; the minutes
field keeps a draft until its owner writes it. Owner tests use a real
presenter on their own store, and view tests render the control.
2026-10-31 19:22:03 -07:00

52 lines
1.7 KiB
JavaScript

// The API-key cost tooltip states an incomplete estimate in the
// interface language; the tracker keeps its English note for diagnostics.
import test from 'node:test';
import assert from 'node:assert/strict';
import { setLocale } from '../i18n/index.js';
import { RealtimeCost } from './realtimeCost.js';
import { createVoiceCostTracker } from './voiceCost.js';
import { createTestVoiceUi } from '../testSupport/voiceUi.mjs';
for (const locale of ['es', 'ru']) {
test(`API-key cost tooltip for an incomplete session has no English (${locale})`, () => {
setLocale(locale);
try {
const costTracker = createVoiceCostTracker({ tier: 'standard' });
costTracker.markIncomplete();
const host = {
costTracker,
voiceTier: 'standard',
cloudVoiceAuth: 'api-key',
sessionCloudVoiceAuth: 'api-key',
isActive: () => false,
ui: createTestVoiceUi(),
};
RealtimeCost.prototype.syncCostUi.call(host);
const title = host.ui.state.cost.title;
assert.ok(title.length > 0);
assert.doesNotMatch(
title,
/Estimate is incomplete|still in flight/,
title,
);
} finally {
setLocale('en');
}
});
}
test('API-key cost tooltip in English still ends with the tracker note', () => {
const costTracker = createVoiceCostTracker({ tier: 'standard' });
costTracker.markIncomplete();
const host = {
costTracker,
voiceTier: 'standard',
cloudVoiceAuth: 'api-key',
sessionCloudVoiceAuth: 'api-key',
isActive: () => false,
ui: createTestVoiceUi(),
};
RealtimeCost.prototype.syncCostUi.call(host);
assert.ok(host.ui.state.cost.title.endsWith(` ${costTracker.state().note}`));
});