Files
ghostgram/submodules/TextFormat/Tests/PastedMarkdownGateTests.swift
ichmagmaus111andClaude Opus 5.5 0622057a4f Ghostgram: open-source release
Ghostgram for iOS, rebuilt from scratch on Telegram iOS 13.0.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 17:57:09 +01:00

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))
}
}