okami.mom/strata
git clone https://git.nkp.pet/okami.mom/strata
4fb068a8c
main
1import test from 'node:test' ; 2import assert from 'node:assert/strict' ; 3import { readFileSync , readdirSync , statSync } from 'node:fs' ; 4import { resolve , join } from 'node:path' ; 5 6const root = resolve ( import . meta. dirname , '..' ); 7const read = ( p ) => readFileSync ( resolve ( root , p ), 'utf8' ); 8 9test ( 'the window title is "Strata" on every page' , () => { 10assert . match ( read ( 'index.html' ), / <title>Strata<\/title> / ); 11assert . match ( read ( 'server/index.mjs' ), / <title>Strata<\/title> / ); 12assert . match ( read ( '../desktop/src-tauri/src/main.rs' ), / WebviewWindowBuilder::new\(app, "main" [ ^ \n ] * \.title\("Strata"\) / ); 13}); 14 15test ( 'no screen sets document.title to anything else' , () => { 16const hits = []; 17const walk = ( dir ) => { 18for ( const name of readdirSync ( dir )) { 19const full = join ( dir , name ); 20if ( statSync ( full ). isDirectory ()) walk ( full ); 21else if ( / \. ( ts | tsx ) $ / . test ( name ) && / document\.title\s * = / . test ( readFileSync ( full , 'utf8' ))) hits . push ( full ); 22} 23}; 24walk ( resolve ( root , 'src' )); 25assert . deepEqual ( hits , []); 26});