e0a5f57793
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.
46 lines
1.1 KiB
TypeScript
46 lines
1.1 KiB
TypeScript
import { getMarkdown, parseMarkdownToStructure } from 'stream-markdown-parser'
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
function walk(value: unknown, visit: (node: any) => void, seen = new WeakSet<object>()) {
|
|
if (!value)
|
|
return
|
|
if (typeof value !== 'object')
|
|
return
|
|
if (seen.has(value))
|
|
return
|
|
seen.add(value)
|
|
|
|
if (Array.isArray(value)) {
|
|
for (const item of value)
|
|
walk(item, visit, seen)
|
|
return
|
|
}
|
|
|
|
const node = value as any
|
|
if (typeof node.type === 'string')
|
|
visit(node)
|
|
|
|
for (const child of Object.values(node))
|
|
walk(child as any, visit, seen)
|
|
}
|
|
|
|
function countNodes(nodes: unknown, type: string) {
|
|
let count = 0
|
|
walk(nodes, (node) => {
|
|
if (node.type === type)
|
|
count++
|
|
})
|
|
return count
|
|
}
|
|
|
|
describe('math inline - ignore empty "$$" delimiter', () => {
|
|
const md = getMarkdown('math-empty-delim')
|
|
|
|
it('keeps "$$" as text to avoid perpetual loading spinners', () => {
|
|
const input = 'adasd $$ dasdsa\ndasdsad'
|
|
const nodes = parseMarkdownToStructure(input, md)
|
|
expect(countNodes(nodes, 'math_inline')).toBe(0)
|
|
expect(JSON.stringify(nodes)).toContain('$$')
|
|
})
|
|
})
|