import test from 'node:test'; import assert from 'node:assert/strict'; import { readFileSync, existsSync } from 'node:fs'; const root = new URL('../apps/gnome-extension/jarvis@qvac.local/', import.meta.url); const tokens = JSON.parse(readFileSync(new URL('brand/tokens.json', root), 'utf8')); const brandSource = readFileSync(new URL('brand.js', root), 'utf8'); const stylesheet = readFileSync(new URL('stylesheet.css', root), 'utf8'); const gtkCss = readFileSync(new URL('brand/gtk.css', root), 'utf8'); const metadata = JSON.parse(readFileSync(new URL('metadata.json', root), 'utf8')); const settingsWindow = readFileSync(new URL('settings-window.js', root), 'utf8'); const extensionSource = readFileSync(new URL('extension.js', root), 'utf8'); const install = readFileSync(new URL('../packaging/install.sh', import.meta.url), 'utf8'); const uninstall = readFileSync(new URL('../packaging/uninstall.sh', import.meta.url), 'utf8'); const icons = [ 'brand/icons/jarvis-mark.svg', 'brand/icons/jarvis-mark-symbolic.svg', 'brand/icons/jarvis-wordmark.svg', 'brand/icons/io.qvac.Jarvis.Control.svg', 'brand/icons/scalable/apps/io.qvac.Jarvis.Control.svg', ]; test('brand tokens match the coded gold and signal palette', () => { assert.equal(tokens.name, 'Jarvis'); assert.equal(tokens.product, 'Jarvis QVAC'); assert.equal(tokens.tagline, 'Local voice for your desktop'); assert.equal(tokens.publisher, 'HoneyPeer, LLC'); assert.equal(tokens.license, 'AGPL-3.0-or-later'); assert.match(brandSource, /publisher: 'HoneyPeer, LLC'/); assert.equal(tokens.colors.gold, '#F4B942'); assert.equal(tokens.colors.signal, '#4FD2FF'); assert.equal(tokens.colors.ink, '#0B0E14'); assert.equal(tokens.accents[0].id, 'gold'); assert.match(brandSource, /gold: '#F4B942'/); assert.match(brandSource, /signal: '#4FD2FF'/); assert.match(brandSource, /tagline: 'Local voice for your desktop'/); }); test('brand icons ship as SVG marks with gold visor and cyan core', () => { for (const icon of icons) { const path = new URL(icon, root); assert.equal(existsSync(path), true, icon); const svg = readFileSync(path, 'utf8'); assert.match(svg, / { assert.match(stylesheet, /--jarvis-accent/); assert.doesNotMatch(stylesheet, /alpha\(/); assert.doesNotMatch(stylesheet, /icon-size:/); assert.doesNotMatch(stylesheet, /\/\*/); assert.match(stylesheet, /\.jarvis-panel-mark/); assert.match(stylesheet, /\.jarvis-talk \{ background-color: #F4B942/); assert.match(gtkCss, /@define-color jarvis_gold #F4B942/); assert.match(gtkCss, /button\.jarvis-swatch-gold/); assert.equal(metadata.name, 'Jarvis'); assert.match(metadata.description, /Local voice for your desktop/); assert.match(settingsWindow, /from '\.\/brand\.js'/); assert.match(settingsWindow, /brandBanner/); assert.match(settingsWindow, /BRAND\.publisher/); assert.match(settingsWindow, /accentRow/); assert.doesNotMatch(settingsWindow, /maxlength/); assert.match(extensionSource, /brand\/icons\/jarvis-mark\.svg/); assert.match(extensionSource, /text: 'Jarvis'/); assert.match(install, /io\.qvac\.Jarvis\.Control\.desktop/); assert.match(install, /Local voice for your desktop/); assert.match(uninstall, /io\.qvac\.Jarvis\.Control\.desktop/); }); test('accent helper rejects invalid hex and keeps Gold', async () => { const { normalizeAccent, DEFAULT_ACCENT, BRAND } = await import(new URL('../apps/gnome-extension/jarvis@qvac.local/brand.js', import.meta.url)); assert.equal(DEFAULT_ACCENT, '#F4B942'); assert.equal(normalizeAccent('#4FD2FF'), '#4FD2FF'); assert.equal(normalizeAccent('not-a-color'), '#F4B942'); assert.equal(normalizeAccent(''), '#F4B942'); assert.equal(BRAND.accents.length, 5); assert.equal(BRAND.publisher, 'HoneyPeer, LLC'); assert.equal(BRAND.license, 'AGPL-3.0-or-later'); });