Loading files
This file is pinned to the selected release. Download the original to open it in your design tool.
6c5dfa008This file is pinned to the selected release. Download the original to open it in your design tool.
import assert from 'node:assert/strict'
import { readFileSync } from 'node:fs'
import { test } from 'node:test'
const settingsViewPath = 'host/modules/ui/views/settings/settings-view.ts'
const defaultLaunchPath = 'host/app/default-behavior/on-launch.ts'
const setupModePath = 'host/app/setup-mode.ts'
test('settings view owns the Piu setup screen construction', () => {
const settingsSource = readFileSync(settingsViewPath, 'utf8')
const launchSource = readFileSync(defaultLaunchPath, 'utf8')
const setupModeSource = readFileSync(setupModePath, 'utf8')
const uiManifest = JSON.parse(readFileSync('host/modules/ui/manifest.json', 'utf8'))
const wasmUiManifest = JSON.parse(readFileSync('host/modules/ui/manifest_wasm.json', 'utf8'))
assert.match(settingsSource, /export const buildSettingsView/)
assert.match(settingsSource, /export const buildSettingsPasswordView/)
assert.match(settingsSource, /export const updateSettingsStatusLabels/)
assert.match(settingsSource, /HorizontalExpandingKeyboard/)
assert.match(settingsSource, /KeyboardField/)
assert.match(settingsSource, /new Container/)
assert.match(settingsSource, /new Column/)
assert.match(settingsSource, /new Label/)
assert.match(settingsSource, /new Scroller/)
assert.match(settingsSource, /new Port/)
assert.match(settingsSource, /drawSignalIcon/)
assert.match(settingsSource, /new ScreenHeader/)
assert.match(settingsSource, /new ActionButton/)
assert.match(settingsSource, /setActionButtonEnabled/)
assert.doesNotMatch(launchSource, /from 'settings-view'/)
assert.doesNotMatch(launchSource, /buildSettingsView/)
assert.doesNotMatch(launchSource, /updateSettingsStatusLabels/)
assert.match(launchSource, /from 'setup-mode'/)
assert.match(setupModeSource, /from 'settings-view'/)
assert.match(setupModeSource, /buildSettingsView/)
assert.match(setupModeSource, /updateSettingsStatusLabels/)
assert.doesNotMatch(launchSource, /new Container/)
assert.doesNotMatch(launchSource, /new Column/)
assert.doesNotMatch(launchSource, /new Label/)
assert.doesNotMatch(launchSource, /new Skin/)
assert.doesNotMatch(launchSource, /new Style/)
assert.doesNotMatch(launchSource, /globalThis\.button/)
assert.equal(uiManifest.modules['settings-view'], './views/settings/settings-view')
assert.equal(wasmUiManifest.modules['settings-view'], './views/settings/settings-view')
assert.match(JSON.stringify(uiManifest.include), /expanding-keyboard\/horizontal\/manifest\.json/)
assert.match(JSON.stringify(wasmUiManifest.include), /expanding-keyboard\/horizontal\/manifest\.json/)
})