hololake-system-architecture/product-source/hololake-native-desktop/scripts/dynamic-language-world-visual-system.test.mjs

32 lines
1.5 KiB
JavaScript
Raw Normal View History

import test from 'node:test'
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
const read = (path) => readFileSync(new URL(`../${path}`, import.meta.url), 'utf8')
const contract = JSON.parse(read('contracts/dynamic-language-world-visual-system.json'))
const rust = read('src-tauri/src/world_climate.rs')
const ui = read('src/main.tsx')
const tokens = read('src/design-tokens.css')
test('dynamic world and fixed traditional themes remain independently selectable', () => {
assert.deepEqual(contract.modes, ['DYNAMIC_LANGUAGE_WORLD', 'FIXED_TRADITIONAL_THEME'])
assert.match(ui, /hololake-visual-mode/)
assert.match(ui, /动态语言世界/)
assert.match(ui, /固定传统主题/)
})
test('verified weather changes visual tokens but never invents weather when offline', () => {
assert.match(rust, /VERIFIED_LIVE/)
assert.match(rust, /TIME_ONLY_WEATHER_UNAVAILABLE/)
assert.match(rust, /city_exposed: false/)
assert.equal(contract.privacy.weather_unavailable_behavior, 'BEIJING_TIME_ONLY_NO_FAKE_WEATHER')
assert.match(tokens, /visual-world\.climate-day/)
assert.match(tokens, /visual-world\.climate-night/)
})
test('the five-domain climate rotation uses internal coordinates and never presents a real city label', () => {
assert.equal(contract.daily_domain_rotation.length, 5)
assert.match(rust, /coordinate_for/)
assert.doesNotMatch(ui, /西安天气|北京天气|广州天气/)
assert.equal(contract.privacy.real_city_exposed_in_ui, false)
})