Tests follow the GUI feedback 2 changes: the picture choice rule moved to pictures-choice.ts, the status line is flex, the new catalog is known to plain-errors

This commit is contained in:
Niko1221 committed 2026-11-02 07:32:59 +01:00
1 parent 56f93d8ee0
commit 35d4781f1c
4 files changed
+7 -5

No files matched your search

+1 -1
View File
@@ -4,7 +4,7 @@ import { readFile } from 'node:fs/promises';
import { build } from 'esbuild';
const languages = ['en', 'zh', 'ja', 'de', 'es', 'ru', 'pt', 'ko', 'fr'];
const catalogs = Object.fromEntries(await Promise.all(languages.map(async l => [l, ({ ...JSON.parse(await readFile(`src/locales/${l}.json`, 'utf8')), ...JSON.parse(await readFile(`src/locales/engine-${l}.json`, 'utf8')) })])));
const catalogs = Object.fromEntries(await Promise.all(languages.map(async l => [l, ({ ...JSON.parse(await readFile(`src/locales/${l}.json`, 'utf8')), ...JSON.parse(await readFile(`src/locales/engine-${l}.json`, 'utf8')), ...JSON.parse(await readFile(`src/locales/gui-${l}.json`, 'utf8')) })])));
const built = await build({ stdin: { contents: "export * from './src/lib/plain-errors'; export * from './src/lib/i18n';", resolveDir: process.cwd() }, bundle: true, write: false, format: 'esm', platform: 'node', loader: { '.json': 'json' } });
const { plainFailure, plainFailureText, setTranslationLanguage } = await import(`data:text/javascript;base64,${Buffer.from(built.outputFiles[0].text).toString('base64')}`);
+5 -2
View File
@@ -144,8 +144,11 @@ test('4d: picture reading is on unless the person turned it off (no saved choice
assert.equal(first().visionEnabled, true);
} finally { await f.cleanup(); }
const screen = readSource(new URL('../src/components/NativeModels.tsx', import.meta.url), 'utf8');
assert.match(screen, /setVision\(installed\.visionEnabled === false && installed\.visionPrepared !== false \? 'no'/);
assert.match(screen, /else\s*\{?\s*setVision\('yes'\)/, 'a version that is not downloaded starts with Read pictures on');
// the rule lives in lib/pictures-choice.ts (GUI-FB2 item 4); the page opens a version with it the first time it sees it installed
const choice = readSource(new URL('../src/lib/pictures-choice.ts', import.meta.url), 'utf8');
assert.match(choice, /installed\.visionEnabled === false && installed\.visionPrepared !== false\) return 'no'/);
assert.match(screen, /shownVision\(known, installed\)/);
assert.match(screen, /shownVision\(visionPicks\.current\.get\(selectedSize\.id\), undefined\)/, 'a version that is not downloaded starts with Read pictures on');
});
test('no recognised engine: the app still downloads, warns in the card, and loading says it with the next step', async () => {
+1 -1
View File
@@ -34,7 +34,7 @@ test('2: pictures are on by default; a missing reader says nothing wordy and sav
assert.match(host, /const visionPreferences=args\.vision!==undefined&&!noReader\?/, 'nothing is saved when the reader is missing');
assert.match(host, /runtimeVision\(config,noReader\?'no':args\.vision\)/);
// An "off" that sits on a model without the picture files is not a choice of the person: it starts on.
assert.match(models, /installed\.visionEnabled === false && installed\.visionPrepared !== false \? 'no'/);
assert.match(readFileSync(new URL('../src/lib/pictures-choice.ts', import.meta.url), 'utf8'), /installed\.visionEnabled === false && installed\.visionPrepared !== false\) return 'no'/);
});
test('6: the conversation context opens at 128K for every configuration, or the model largest size when that is smaller; a warning, never a refusal', async () => {
-1
View File
@@ -48,7 +48,6 @@ test('item 10 / GUI-FB2 item 7: the status line is a wrapping flex row with no f
assert.doesNotMatch(css, /\.live-status[^{]*\{[^}]*\b6ch\b/, 'no fixed column for the time');
assert.match(css, /\.live-status__verb \{ flex: 0 1 24ch; min-width: 0;/, 'the word gives way first');
assert.match(css, /\.live-status__time, \.live-status__tokens \{ flex: none; font-variant-numeric: tabular-nums/);
assert.match(css, /\.live-status__time, \.live-status__tokens \{ font-variant-numeric: tabular-nums/);
assert.match(line, /live-status__verb/); assert.match(line, /live-status__time/); assert.match(line, /live-status__tokens/);
});