mirror of
https://github.com/bilawalsidhu/gods-eye-view.git
synced 2026-11-16 08:12:24 +00:00
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.
52 lines
1.7 KiB
JavaScript
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}`));
|
|
});
|