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.
28 lines
1.1 KiB
TypeScript
28 lines
1.1 KiB
TypeScript
import { describe, expect, it } from 'vitest'
|
|
import { getMarkdown, parseMarkdownToStructure } from '../src'
|
|
|
|
describe('parseMarkdownToStructure - streaming strong+math', () => {
|
|
it('does not hang on unclosed strong ending with a closed $...$ span', { timeout: 500 }, () => {
|
|
const md = getMarkdown('stream-strong-math')
|
|
const markdown = '> **给定输入 $ x $'
|
|
|
|
expect(() => parseMarkdownToStructure(markdown, md)).not.toThrow()
|
|
|
|
// Simulate streaming: repeatedly parse progressive prefixes.
|
|
for (let i = 1; i <= markdown.length; i++) {
|
|
const chunk = markdown.slice(0, i)
|
|
expect(() => parseMarkdownToStructure(chunk, md)).not.toThrow()
|
|
}
|
|
})
|
|
|
|
it('does not recurse forever when a streaming strong prefix ends right before math opener content', { timeout: 500 }, () => {
|
|
const md = getMarkdown('stream-strong-heading-math')
|
|
const markdown = '### 1. **理解 \\\\(\\\\boldsymbol{alpha}^T \\\\boldsymbol{\\\\beta} = 0\\\\) 的含义**'
|
|
|
|
for (let i = 1; i <= markdown.length; i++) {
|
|
const chunk = markdown.slice(0, i)
|
|
expect(() => parseMarkdownToStructure(chunk, md, { final: false })).not.toThrow()
|
|
}
|
|
})
|
|
})
|