71 lines
3.9 KiB
JavaScript
71 lines
3.9 KiB
JavaScript
import assert from 'node:assert/strict'
|
|
import { readFile } from 'node:fs/promises'
|
|
import test from 'node:test'
|
|
|
|
const root = new URL('../', import.meta.url)
|
|
const read = (path) => readFile(new URL(path, root), 'utf8')
|
|
|
|
test('release center records every shipped HoloLake line from 0.4.0 through current', async () => {
|
|
const contract = JSON.parse(await read('contracts/product-release-center.json'))
|
|
assert.equal(contract.schema, 'hololake.product-release-center/v1')
|
|
assert.equal(contract.currentVersion, '0.9.1')
|
|
const versions = contract.releases.map((release) => release.version)
|
|
for (const version of ['0.4.0', '0.4.1', '0.5.0', '0.6.0', '0.7.0', '0.8.1', '0.9.0', '0.9.1']) assert.ok(versions.includes(version), version)
|
|
assert.equal(contract.releases.filter((release) => release.state === 'CURRENT').length, 1)
|
|
for (const release of contract.releases) {
|
|
assert.ok(release.title.length > 0)
|
|
assert.ok(release.summary.length > 0)
|
|
assert.ok(release.highlights.length >= 3)
|
|
assert.ok(release.evidence.length >= 1)
|
|
}
|
|
})
|
|
|
|
test('one engine exposes Guanghu and standard workbench projections with a human default', async () => {
|
|
const source = await read('src/main.tsx')
|
|
const styles = await read('src/styles.css')
|
|
assert.match(source, /type PresentationMode = 'guanghu' \| 'workbench'/)
|
|
assert.match(source, /type AudienceLayer = 'human' \| 'execution'/)
|
|
assert.match(source, /hololake-presentation-mode/)
|
|
assert.match(source, /hololake-audience-layer/)
|
|
assert.match(source, /\|\| 'human'/)
|
|
assert.match(source, /className="standard-workbench"/)
|
|
assert.match(source, /HoloLake \{productReleaseCenter\.currentVersion\}/)
|
|
assert.doesNotMatch(source, /HoloLake · V0\.8\.1/)
|
|
assert.match(source, /renderWorkbenchHuman()/)
|
|
assert.match(source, /renderExecutionProjection\(\)/)
|
|
assert.match(source, /人格体结构化执行界面/)
|
|
assert.match(source, /presentationMode !== 'workbench' \|\| view !== 'persona'/)
|
|
assert.match(source, /void refreshPersonaBodyModule\(\)/)
|
|
assert.match(source, /<PersonaChannelBody onBack=\{\(\) => \{ setView\('overview'\); setWorldStage\(toolReturnStage\) \}\}/)
|
|
assert.match(styles, /\.standard-workbench\s*\{[^}]*display:\s*grid;[^}]*grid-template-columns:\s*52px 244px minmax\(0, 1fr\);/s)
|
|
assert.match(styles, /@media \(max-width: 640px\)\s*\{[^}]*\.standard-workbench\s*\{[^}]*grid-template-columns:\s*46px minmax\(0, 1fr\);/s)
|
|
assert.ok(styles.indexOf('.workbench-sidebar { display: none; }') > styles.indexOf('@media (max-width: 640px)'))
|
|
})
|
|
|
|
test('main domain routes to the public release center instead of a descriptive popup', async () => {
|
|
const source = await read('src/main.tsx')
|
|
assert.match(source, /publicDomain === 'MAIN_DOMAIN'/)
|
|
assert.match(source, /main-domain-release-center/)
|
|
assert.match(source, /光湖主域 · 公告与版本/)
|
|
assert.match(source, /renderReleaseCenter\('human'\)/)
|
|
})
|
|
|
|
test('public language persona copy is formal and keeps a visible human composer', async () => {
|
|
const source = await read('src/modules/persona-channel-body/index.tsx')
|
|
assert.match(source, /<h1>\{conversation\?\.title \|\| \(embedded \? '对话与知识协作' : '语言人格频道'\)\}<\/h1>/)
|
|
assert.match(source, /冰朔 · ICE-GL∞/)
|
|
assert.match(source, /输入消息;需要知识时可直接提问。/)
|
|
assert.match(source, /<textarea/)
|
|
assert.match(source, /send_message/)
|
|
assert.doesNotMatch(source, /说点什么/)
|
|
assert.doesNotMatch(source, /先让频道知道你要和谁说话/)
|
|
})
|
|
|
|
test('all native product manifests advertise the same version', async () => {
|
|
const packageJson = JSON.parse(await read('package.json'))
|
|
const tauri = JSON.parse(await read('src-tauri/tauri.conf.json'))
|
|
const cargo = await read('src-tauri/Cargo.toml')
|
|
assert.equal(packageJson.version, '0.9.1')
|
|
assert.equal(tauri.version, packageJson.version)
|
|
assert.match(cargo, /version = "0\.9\.1"/)
|
|
})
|