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

47 lines
1.9 KiB
TypeScript

import { getMarkdown, parseMarkdownToStructure } from 'stream-markdown-parser'
import { describe, expect, it } from 'vitest'
import { links, textIncludes } from '../utils/midstate-utils'
const md = getMarkdown('midstates')
describe('autolink handling', () => {
it('bare http URL should be parsed as a link node (autolink)', () => {
const nodes = parseMarkdownToStructure('http://a', md)
const ls = links(nodes)
expect(ls.length).toBeGreaterThanOrEqual(1)
const l = ls[0] as any
expect(textIncludes(l, 'http://a') || l.href === 'http://a' || /http:\/\/.+/.test(String(l.href))).toBe(true)
// autolinks should not be considered loading
expect(!!l.loading).toBe(false)
})
it('angle-bracket autolink <http://a> should be parsed as link', () => {
const nodes = parseMarkdownToStructure('<http://a>', md)
const ls = links(nodes)
if (ls.length > 0) {
const l = ls[0] as any
expect(textIncludes(l, 'http://a') || String(l.href).includes('http://a')).toBe(true)
}
else {
// tokenizer may choose to leave raw text; accept that fallback
expect(textIncludes(nodes, '<http://a>') || textIncludes(nodes, 'http://a')).toBe(true)
}
})
it('bracketed link with title containing emoji (mid-state) should NOT be misclassified as autolink', () => {
const nodes = parseMarkdownToStructure('[x](http://a "t😁"', md)
const ls = links(nodes)
if (ls.length > 0) {
// If parser produced a link, it should be loading (mid-state) rather than finalized autolink
expect(!!ls[0].loading).toBe(true)
// title or children should include emoji or stub
const ok = textIncludes(ls[0], '😁') || textIncludes(ls[0], 't') || textIncludes(nodes, 't') || textIncludes(nodes, '😁')
expect(ok).toBe(true)
}
else {
// Accept text fallback containing the raw mid-state
expect(textIncludes(nodes, '[x](http://a "t😁"') || textIncludes(nodes, 't😁')).toBe(true)
}
})
})