Files
BoosAPI/desktop/libs/markstream-vue/test/playground-react-live-preview-config.test.ts
T
boos e0a5f57793 feat(desktop): embed BoosAPI Desktop client as a subproject
Vendor the rebranded BoosAPI Desktop client (Tauri + Vue) into metapi as
a monorepo subdirectory under desktop/. Source only — node_modules,
dist, Cargo target and the upstream .git history are excluded.

desktop/ keeps its own independent Cargo workspace (desktop/src-tauri
with crates/*); it is not part of the backend boosapi crate, so a
`cargo check` at the metapi root still compiles only the backend. Build
the desktop app from desktop/src-tauri per desktop/README.md.

Note: app icons are still placeholder assets pending the final BoosAPI
logo. The updater signing keys live outside the repo and are not
included.
2026-06-22 11:32:57 +08:00

51 lines
2.8 KiB
TypeScript

import { readFileSync } from 'node:fs'
import { resolve } from 'node:path'
import { describe, expect, it } from 'vitest'
function readSource(path: string) {
return readFileSync(resolve(process.cwd(), path), 'utf8')
}
describe('playground-react live preview config', () => {
it('keeps the shared React playground custom scope in one place', () => {
const sharedSource = readSource('playground-react18/src/shared/markstreamPlayground.ts')
expect(sharedSource).toContain('PLAYGROUND_CUSTOM_ID = \'playground-demo\'')
expect(sharedSource).toContain('PLAYGROUND_CUSTOM_HTML_TAGS = [\'thinking\'] as const')
})
it('wires React 18 preview surfaces to the shared custom html config', () => {
const appSource = readSource('playground-react18/src/App.tsx')
const testLabSource = readSource('playground-react18/src/shared/TestLab.tsx')
const migrationSource = readSource('playground-react18/src/shared/MigrationDemoPage.tsx')
const thinkingSource = readSource('playground-react18/src/components/ThinkingNode.tsx')
expect(appSource).toContain('import { PLAYGROUND_CUSTOM_HTML_TAGS, PLAYGROUND_CUSTOM_ID } from \'./shared/markstreamPlayground\'')
expect(appSource).toContain('customHtmlTags={PLAYGROUND_CUSTOM_HTML_TAGS}')
expect(testLabSource).toContain('import { PLAYGROUND_CUSTOM_HTML_TAGS, PLAYGROUND_CUSTOM_ID } from \'./markstreamPlayground\'')
expect(testLabSource).toContain('customId={PLAYGROUND_CUSTOM_ID}')
expect(testLabSource).toContain('customHtmlTags={PLAYGROUND_CUSTOM_HTML_TAGS}')
expect(migrationSource).toContain('import { PLAYGROUND_CUSTOM_HTML_TAGS, PLAYGROUND_CUSTOM_ID } from \'./markstreamPlayground\'')
expect(migrationSource).toContain('customId={PLAYGROUND_CUSTOM_ID}')
expect(migrationSource).toContain('customHtmlTags={PLAYGROUND_CUSTOM_HTML_TAGS}')
expect(thinkingSource).toContain('import { PLAYGROUND_CUSTOM_HTML_TAGS } from \'../shared/markstreamPlayground\'')
expect(thinkingSource).toContain('customHtmlTags={PLAYGROUND_CUSTOM_HTML_TAGS}')
expect(thinkingSource).toContain('props.children')
})
it('wires React 19 preview surfaces to the shared custom html config', () => {
const appSource = readSource('playground-react19/src/App.tsx')
const thinkingSource = readSource('playground-react19/src/components/ThinkingNode.tsx')
expect(appSource).toContain('import { PLAYGROUND_CUSTOM_HTML_TAGS, PLAYGROUND_CUSTOM_ID } from \'../../playground-react18/src/shared/markstreamPlayground\'')
expect(appSource).toContain('customHtmlTags={PLAYGROUND_CUSTOM_HTML_TAGS}')
expect(thinkingSource).toContain('import { PLAYGROUND_CUSTOM_HTML_TAGS } from \'../../../playground-react18/src/shared/markstreamPlayground\'')
expect(thinkingSource).toContain('customHtmlTags={PLAYGROUND_CUSTOM_HTML_TAGS}')
expect(thinkingSource).toContain('props.children')
})
})