Files
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

79 lines
2.1 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { parseNestedMarkdownToNodes } from '../packages/markstream-vue2/src/utils/nestedNodes'
describe('vue2 nested nodes helper', () => {
it('returns a shallow copy when nodes are already provided', () => {
const nodes = [
{
type: 'paragraph',
raw: '',
children: [
{ type: 'text', raw: '', content: 'hello' },
],
},
] as any[]
const parsed = parseNestedMarkdownToNodes({ nodes })
expect(parsed).toEqual(nodes)
expect(parsed).not.toBe(nodes)
})
it('prefers existing node children over reparsing content', () => {
const parsed = parseNestedMarkdownToNodes({
node: {
type: 'thinking',
raw: '',
content: 'should not be used',
children: [
{
type: 'paragraph',
raw: '',
children: [
{ type: 'text', raw: '', content: 'nested child' },
],
},
],
} as any,
})
expect(parsed).toHaveLength(1)
expect((parsed[0] as any).type).toBe('paragraph')
expect(((parsed[0] as any).children?.[0] as any)?.content).toBe('nested child')
})
it('parses streaming custom-tag content into stable nested nodes', () => {
const partial = parseNestedMarkdownToNodes(
{
content: '<thinking>streaming body',
},
{
cacheKey: 'vue2-nested-nodes-streaming',
customHtmlTags: ['thinking'],
final: false,
},
) as any[]
expect(partial).toHaveLength(1)
expect(partial[0]?.type).toBe('thinking')
expect(partial[0]?.loading).toBe(true)
expect(String(partial[0]?.content || '')).toContain('streaming body')
const complete = parseNestedMarkdownToNodes(
{
content: '<thinking>before\n\n- item</thinking>',
},
{
cacheKey: 'vue2-nested-nodes-complete',
customHtmlTags: ['thinking'],
final: true,
},
) as any[]
expect(complete).toHaveLength(1)
expect(complete[0]?.type).toBe('thinking')
expect(complete[0]?.loading).toBe(false)
expect(String(complete[0]?.content || '')).toContain('- item')
})
})