hololake-system-architecture/product-source/hololake-native-desktop/scripts/channel-surface-layout.test.mjs

26 lines
1.1 KiB
JavaScript

import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import test from 'node:test'
const read = (path) => readFileSync(new URL(`../${path}`, import.meta.url), 'utf8')
test('channel surface gives every visible entry its own layout slot', () => {
const source = read('src/main.tsx')
const styles = read('src/styles.css')
const channel = source.match(/\{worldStage === 'channel'[\s\S]*?\n \{worldStage === 'enterpriseWork'/)?.[0]
assert.ok(channel, 'channel world source must remain discoverable')
assert.match(channel, /className="channel-primary"/)
assert.match(channel, /className="channel-marketplace"/)
assert.equal((channel.match(/className="channel-main"/g) || []).length, 0)
assert.match(styles, /\.channel-primary\s*\{/)
assert.match(styles, /\.channel-marketplace\s*\{/)
})
test('the domain stage has exactly one atmosphere owner', () => {
const source = read('src/main.tsx')
assert.match(
source,
/\{!\(worldStage === 'domain' && surface === 'world'\) && <LakeAtmosphere awake=\{motionAwake\}\/>\}/,
)
})