2026-01-16 09:16:39 +00:00
|
|
|
import Testing
|
2026-01-30 03:15:10 +01:00
|
|
|
@testable import OpenClawChatUI
|
2026-01-16 09:16:39 +00:00
|
|
|
|
|
|
|
|
@Suite("ChatMarkdownPreprocessor")
|
|
|
|
|
struct ChatMarkdownPreprocessorTests {
|
|
|
|
|
@Test func extractsDataURLImages() {
|
|
|
|
|
let base64 = "iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVQIHWP4////GQAJ+wP/2hN8NwAAAABJRU5ErkJggg=="
|
|
|
|
|
let markdown = """
|
|
|
|
|
Hello
|
|
|
|
|
|
|
|
|
|
)
|
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
let result = ChatMarkdownPreprocessor.preprocess(markdown: markdown)
|
|
|
|
|
|
|
|
|
|
#expect(result.cleaned == "Hello")
|
|
|
|
|
#expect(result.images.count == 1)
|
|
|
|
|
#expect(result.images.first?.image != nil)
|
|
|
|
|
}
|
|
|
|
|
}
|