okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
85269ca15
main
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' , () => { 11const text = source . match ( / const NOTES = " ([ ^ " ] * ) "; / )?.[ 1 ]; 12assert . equal ( text , SENTENCES . join ( ' ' )); 13assert . 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' , () => { 17const joined = SENTENCES . join ( ' ' ); 18const en = JSON . parse ( readFileSync ( resolve ( root , 'src/locales/en.json' ), 'utf8' )); 19const id = Object . keys ( en ). find ( k => en [ k ] === joined ); 20assert . ok ( id , 'the English catalog has the whole paragraph' ); 21for ( const lang of [ 'zh' , 'ja' , 'de' , 'es' , 'ru' , 'pt' , 'ko' , 'fr' ]) { 22const cat = JSON . parse ( readFileSync ( resolve ( root , `src/locales/ ${ lang } .json` ), 'utf8' )); 23assert . ok ( cat [ id ] && cat [ id ] !== joined && cat [ id ]. length > 80 , ` ${ lang } has its own translation of the paragraph` ); 24} 25});