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

38 lines
1.3 KiB
TypeScript

import { describe, expect, it } from 'vitest'
import { getMarkdown, parseMarkdownToStructure } from '../src'
describe('link attrs parsing', () => {
it('preserves custom attrs injected on link_open tokens', () => {
const md = getMarkdown('link-attrs')
const nodes = parseMarkdownToStructure('[Example](https://example.com)', md, {
preTransformTokens(tokens: any[]) {
for (const token of tokens) {
if (token?.type !== 'inline' || !Array.isArray(token.children))
continue
for (const child of token.children) {
if (child?.type !== 'link_open')
continue
if (typeof child.attrSet === 'function') {
child.attrSet('target', '_self')
child.attrSet('data-track', 'cta')
}
else {
child.attrs = [...(child.attrs ?? []), ['target', '_self'], ['data-track', 'cta']]
}
}
}
return tokens
},
})
const para = nodes[0] as any
const link = para.children.find((c: any) => c.type === 'link')
expect(link).toBeDefined()
expect(link.attrs).toEqual(expect.arrayContaining([
['href', 'https://example.com'],
['target', '_self'],
['data-track', 'cta'],
]))
})
})