Files
BoosAPI/desktop/libs/markstream-vue/test/react-ssr-math-unicode-unit-render-regression.test.tsx
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

45 lines
1.7 KiB
TypeScript

/**
* @vitest-environment node
*/
import { createRequire } from 'node:module'
import { describe, expect, it } from 'vitest'
const packageRequire = createRequire(new URL('../packages/markstream-react/package.json', import.meta.url))
const React = packageRequire('react') as typeof import('react')
const { renderToStaticMarkup } = packageRequire('react-dom/server') as typeof import('react-dom/server')
describe('markstream-react SSR math unicode unit render regression', () => {
it('renders inline and block formulas with unicode unit glyphs on the server', async () => {
const serverEntry = await import('../packages/markstream-react/src/server')
const inlineHtml = renderToStaticMarkup(
React.createElement(serverEntry.MathInlineNode, {
node: {
type: 'math_inline',
content: 'c=0.75\\times10^3\\ \\text{J/(kg·℃)}',
raw: '$c=0.75\\times10^3\\ \\text{J/(kg·℃)}$',
markup: '$',
loading: false,
},
}),
)
const blockHtml = renderToStaticMarkup(
React.createElement(serverEntry.MathBlockNode, {
node: {
type: 'math_block',
content: 'Q_1=0.75\\times10^3\\ \\text{J/(kg·℃)}\\times1.1\\ \\text{kg}\\times40℃=3.3\\times 10^{4}\\ \\text{J}',
raw: '$$Q_1=0.75\\times10^3\\ \\text{J/(kg·℃)}\\times1.1\\ \\text{kg}\\times40℃=3.3\\times 10^{4}\\ \\text{J}$$',
loading: false,
},
}),
)
expect(inlineHtml).toContain('class="katex"')
expect(inlineHtml).not.toContain('math-inline--fallback')
expect(blockHtml).toContain('class="katex-display"')
expect(blockHtml).not.toContain('math-block__fallback')
})
})