import { existsSync, readFileSync } from 'node:fs'; import { join } from 'node:path'; import { describe, expect, it } from 'vitest'; const srcRoot = join(process.cwd(), 'src'); function readSource(relativePath: string): string { return readFileSync(join(srcRoot, relativePath), 'utf8'); } describe('light visual system', () => { it('removes the user-facing theme switch from settings', () => { const settingsSource = readSource('pages/Settings/index.tsx'); expect(settingsSource).not.toMatch(/themeOptions/); expect(settingsSource).not.toMatch(/appearance\.theme/); expect(settingsSource).not.toMatch(/setTheme/); }); it('keeps the app shell in light mode instead of following system dark mode', () => { const appSource = readSource('App.tsx'); expect(appSource).toMatch(/root\.classList\.add\('light'\)/); expect(appSource).not.toMatch(/prefers-color-scheme: dark/); expect(appSource).not.toMatch(/root\.classList\.add\(theme\)/); expect(appSource).not.toMatch(/root\.classList\.add\(systemTheme\)/); }); it('does not use legacy dark navy shell backgrounds', () => { const shellSource = [ readSource('components/layout/Sidebar.tsx'), readSource('pages/Chat/OpencodeChatPanel.tsx'), readSource('pages/Makelore/index.tsx'), ].join('\n'); expect(shellSource).not.toMatch( /bg-\[#(?:0f1220|101322|11131f|141727|171522|192033|211d31|2b2b31)\]/i, ); }); it('uses orange as the product primary color and removes legacy blue UI accents', () => { const globalsSource = readSource('styles/globals.css'); const uiSource = [ readSource('App.tsx'), readSource('pages/Chat/OpencodeChatPanel.tsx'), readSource('pages/KangarooPartner/index.tsx'), readSource('pages/Makelore/index.tsx'), readSource('pages/Models/index.tsx'), ].join('\n'); expect(globalsSource).toMatch(/--primary:\s*15 82% 45%;/); expect(globalsSource).toMatch(/--brand:\s*15 82% 45%;/); expect(globalsSource).toMatch(/--brand-hover:\s*15 84% 38%;/); expect(uiSource).not.toMatch(/#3A5578|#F2F5F8|#4b6385|bg-sky-500/i); }); it('does not reserve synthetic height for chat transcript message wrappers', () => { const globalsSource = readSource('styles/globals.css'); const transcriptRule = globalsSource.match(/\.chat-transcript-message\s*\{[^}]*\}/)?.[0] ?? ''; expect(transcriptRule).not.toContain('content-visibility'); expect(transcriptRule).not.toContain('contain-intrinsic-size'); }); it('uses bundled mixed-script typography with language-aware fallbacks', () => { const globalsSource = readSource('styles/globals.css'); const tailwindSource = readFileSync(join(process.cwd(), 'tailwind.config.js'), 'utf8'); const appSource = readSource('App.tsx'); expect(globalsSource).toContain('font-family: "Makelore Latin";'); expect(globalsSource).toContain('font-family: "Makelore CJK";'); expect(globalsSource).toContain('SourceHanSansSC-Regular.otf'); expect(globalsSource).toContain('unicode-range: U+2E80-2EFF'); expect(globalsSource).toContain('font-display: swap;'); expect(tailwindSource).toContain("var(--font-sans)"); expect(appSource).toContain('root.dataset.uiLanguage = resolvedLanguage;'); expect(appSource).toContain("root.lang = resolvedLanguage === 'zh' ? 'zh-CN' : resolvedLanguage;"); expect(existsSync(join(process.cwd(), 'src/assets/fonts/InterVariable.woff2'))).toBe(true); expect(existsSync(join(process.cwd(), 'src/assets/fonts/InterVariable-Italic.woff2'))).toBe(true); expect(existsSync(join(process.cwd(), 'src/assets/fonts/SourceHanSansSC-Regular.otf'))).toBe(true); expect(existsSync(join(process.cwd(), 'public/fonts/licenses/OFL-1.1.txt'))).toBe(true); expect(existsSync(join(process.cwd(), 'public/fonts/licenses/NOTICE.md'))).toBe(true); }); });