okami.mom/strata

git clone https://git.nkp.pet/okami.mom/strata

Niko1221Merge f-0213-guidata (final 1d5096beb) into f-0213-int85269ca15

main
1.6 KiB25 linesraw
1import test from 'node:test';
2import assert from 'node:assert/strict';
3import {readFileSync} from 'node:fs';
4import {resolve} from 'node:path';
5
6const root = resolve(import.meta.dirname, '..');
7const source = readFileSync(resolve(root, 'src/components/PrivacyNotes.tsx'), 'utf8');
8const SENTENCES = ['Strata sends no usage telemetry.', "Conversations stay on this computer, in Strata's data folder.", 'When you choose an API model, that conversation and enabled skill instructions are sent to its provider.', 'The UI request log keeps client, timing and token metadata in memory.', 'Native API monitoring can retain request content in memory when enabled.', 'Connected tools access the resources you configure.'];
9
10test('Privacy is one compact paragraph with all six sentences, in order', () => {
11  const text = source.match(/const NOTES = "([^"]*)";/)?.[1];
12  assert.equal(text, SENTENCES.join(' '));
13  assert.equal((source.match(/<p>/g) ?? []).length, 1, 'one paragraph, not a line per sentence');
14});
15
16test('the paragraph is translated as a whole in all 9 languages', () => {
17  const joined = SENTENCES.join(' ');
18  const en = JSON.parse(readFileSync(resolve(root, 'src/locales/en.json'), 'utf8'));
19  const id = Object.keys(en).find(k => en[k] === joined);
20  assert.ok(id, 'the English catalog has the whole paragraph');
21  for (const lang of ['zh', 'ja', 'de', 'es', 'ru', 'pt', 'ko', 'fr']) {
22    const cat = JSON.parse(readFileSync(resolve(root, `src/locales/${lang}.json`), 'utf8'));
23    assert.ok(cat[id] && cat[id] !== joined && cat[id].length > 80, `${lang} has its own translation of the paragraph`);
24  }
25});