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

113 lines
3.8 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { getMarkdown, parseMarkdownToStructure } from '../src'
describe('strong containing link edge-case', () => {
it('parses **[百度](https://baidu.com/)** as strong -> link -> text', () => {
const md = getMarkdown()
const label = '\u767E\u5EA6'
const markdown = `**[${label}](https://baidu.com/)*`
const nodes = parseMarkdownToStructure(markdown, md)
// top-level should be a paragraph
const para = nodes[0] as any
expect(para.type).toBe('paragraph')
const strong = para.children?.[0]
expect(strong).toBeDefined()
expect(strong.type).toBe('strong')
const link = strong.children?.[0]
expect(link).toBeDefined()
expect(link.type).toBe('link')
// markdown-it may normalize or ensure trailing slash; accept main host
expect(link.href).toMatch(/https:\/\/baidu\.com\/?/)
const text = link.children?.[0]
expect(text).toBeDefined()
expect(text.type).toBe('text')
expect(text.content).toBe(label)
})
it('parses **[DR **(Danmarks Radio)](https://baidu.com/)** as strong -> link -> text', () => {
const md = getMarkdown()
const label = 'DR **(Danmarks Radio)'
const markdown = `**[${label}](https://baidu.com/)*`
const nodes = parseMarkdownToStructure(markdown, md)
// top-level should be a paragraph
const para = nodes[0] as any
expect(para.type).toBe('paragraph')
const strong = para.children?.[0]
expect(strong).toBeDefined()
expect(strong.type).toBe('strong')
const link = strong.children?.[0]
expect(link).toBeDefined()
expect(link.type).toBe('link')
// markdown-it may normalize or ensure trailing slash; accept main host
expect(link.href).toMatch(/https:\/\/baidu\.com\/?/)
const text = link.children?.[0]
const strongText = link.children?.[1]
expect(strongText).toBeDefined()
expect(strongText.type).toBe('strong')
expect(strongText.children?.[0].content).toBe('(Danmarks Radio)')
expect(text).toBeDefined()
expect(text.type).toBe('text')
expect(text.content).toBe('DR ')
})
it('parses **[DR (Danmarks Radio)**](https://baidu.com/)** as strong -> link -> text', () => {
const md = getMarkdown()
const label = 'DR (Danmarks Radio)**'
const markdown = `**[${label}](https://baidu.com/)*`
const nodes = parseMarkdownToStructure(markdown, md)
// top-level should be a paragraph
const para = nodes[0] as any
expect(para.type).toBe('paragraph')
const strong = para.children?.[0]
expect(strong).toBeDefined()
expect(strong.type).toBe('strong')
const link = strong.children?.[0]
expect(link).toBeDefined()
expect(link.type).toBe('link')
// markdown-it may normalize or ensure trailing slash; accept main host
expect(link.href).toMatch(/https:\/\/baidu\.com\/?/)
const text = link.children?.[0]
expect(text).toBeDefined()
expect(text.type).toBe('text')
expect(text.content).toBe(label.slice(0, -2))
})
it('parses **[**(Danmarks Radio)**](https://baidu.com/)** as strong -> link -> text', () => {
const md = getMarkdown()
const label = '**(Danmarks Radio)**'
const markdown = `**[${label}](https://baidu.com/)*`
const nodes = parseMarkdownToStructure(markdown, md)
// top-level should be a paragraph
const para = nodes[0] as any
expect(para.type).toBe('paragraph')
const strong = para.children?.[0]
expect(strong).toBeDefined()
expect(strong.type).toBe('strong')
const link = strong.children?.[0]
expect(link).toBeDefined()
expect(link.type).toBe('link')
// markdown-it may normalize or ensure trailing slash; accept main host
expect(link.href).toMatch(/https:\/\/baidu\.com\/?/)
const text = link.children?.[0]
expect(text).toBeDefined()
expect(text.type).toBe('strong')
expect(text.children?.[0].content).toBe(label.slice(2, -2))
})
})