mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-11-03 14:17:19 +01:00
Ghostgram for iOS, rebuilt from scratch on Telegram iOS 13.0. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
44 lines
1.7 KiB
Swift
44 lines
1.7 KiB
Swift
import XCTest
|
|
import Postbox
|
|
import TelegramCore
|
|
import TextFormat
|
|
|
|
final class PastedMarkdownGateTests: XCTestCase {
|
|
private func para(_ runs: [ChatInputRun], style: ChatInputParagraphStyle = .body, list: ChatInputListMembership? = nil) -> ChatInputBlock {
|
|
return .paragraph(ChatInputParagraph(style: style, list: list, runs: runs))
|
|
}
|
|
|
|
func test_singlePlainParagraph_isNotRicher() {
|
|
let content = ChatInputContent(blocks: [para([ChatInputRun(text: "hello world")])])
|
|
XCTAssertFalse(pastedMarkdownContentIsRicherThanPlain(content))
|
|
}
|
|
|
|
func test_multiplePlainParagraphs_isNotRicher() {
|
|
let content = ChatInputContent(blocks: [
|
|
para([ChatInputRun(text: "line one")]),
|
|
para([ChatInputRun(text: "line two")])
|
|
])
|
|
XCTAssertFalse(pastedMarkdownContentIsRicherThanPlain(content))
|
|
}
|
|
|
|
func test_emptyContent_isNotRicher() {
|
|
XCTAssertFalse(pastedMarkdownContentIsRicherThanPlain(ChatInputContent(blocks: [])))
|
|
}
|
|
|
|
func test_inlineBold_isRicher() {
|
|
var bold = ChatInputInlineAttributes(); bold.bold = true
|
|
let content = ChatInputContent(blocks: [para([ChatInputRun(text: "hi", attributes: bold)])])
|
|
XCTAssertTrue(pastedMarkdownContentIsRicherThanPlain(content))
|
|
}
|
|
|
|
func test_heading_isRicher() {
|
|
let content = ChatInputContent(blocks: [para([ChatInputRun(text: "Title")], style: .heading1)])
|
|
XCTAssertTrue(pastedMarkdownContentIsRicherThanPlain(content))
|
|
}
|
|
|
|
func test_codeBlock_isRicher() {
|
|
let content = ChatInputContent(blocks: [.code(ChatInputCode(language: nil, runs: [ChatInputRun(text: "print(1)")]))])
|
|
XCTAssertTrue(pastedMarkdownContentIsRicherThanPlain(content))
|
|
}
|
|
}
|