import assert from 'node:assert/strict' import fs from 'node:fs' import test from 'node:test' const frontend = fs.readFileSync(new URL('../src/main.tsx', import.meta.url), 'utf8') const architecture = JSON.parse( fs.readFileSync(new URL('../../../routing/hololake-current-architecture.json', import.meta.url), 'utf8'), ) test('returning to the main world preserves the authenticated session', () => { const handler = frontend.match(/const returnToMainWorld = \(\) => \{([\s\S]*?)\n \}/)?.[1] || '' assert.match(handler, /setShowMainWorld\(true\)/) assert.doesNotMatch(handler, /signOutRepo|setRepoLogin\(null\)|sign_out_code_repo_login/) assert.match(frontend, /if \(!repoLogin \|\| showMainWorld\)/) }) test('main-world return and account sign-out remain separate visible actions', () => { assert.match(frontend, />返回主世界进入所属域退出账号