test: fix old markdown tests
This commit is contained in:
@@ -1,87 +0,0 @@
|
||||
//
|
||||
// MarkdownTests.swift
|
||||
// damusTests
|
||||
//
|
||||
// Created by Lionello Lunesu on 2022-12-28.
|
||||
//
|
||||
|
||||
import XCTest
|
||||
@testable import damus
|
||||
|
||||
class MarkdownTests: XCTestCase {
|
||||
let md_opts: AttributedString.MarkdownParsingOptions =
|
||||
.init(interpretedSyntax: .inlineOnlyPreservingWhitespace)
|
||||
|
||||
override func setUpWithError() throws {
|
||||
// Put setup code here. This method is called before the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
override func tearDownWithError() throws {
|
||||
// Put teardown code here. This method is called after the invocation of each test method in the class.
|
||||
}
|
||||
|
||||
func test_convert_link() throws {
|
||||
let helper = Markdown()
|
||||
let md = helper.process("prologue https://nostr.build epilogue")
|
||||
let expected = try AttributedString(markdown: "prologue [https://nostr.build](https://nostr.build) epilogue", options: md_opts)
|
||||
XCTAssertEqual(md, expected)
|
||||
}
|
||||
|
||||
func test_convert_link_no_scheme() throws {
|
||||
let helper = Markdown()
|
||||
let md = helper.process("prologue damus.io epilogue")
|
||||
let expected = try AttributedString(markdown: "prologue [damus.io](https://damus.io) epilogue", options: md_opts)
|
||||
XCTAssertEqual(md, expected)
|
||||
}
|
||||
|
||||
func test_longform_rendering() throws {
|
||||
let st = test_damus_state()
|
||||
let artifacts = render_note_content(ev: test_longform_event.event, profiles: st.profiles, privkey: st.keypair.privkey)
|
||||
|
||||
switch artifacts {
|
||||
case .separated:
|
||||
XCTAssert(false)
|
||||
case .parts(let parts):
|
||||
XCTAssertEqual(parts.parts.count, 1)
|
||||
}
|
||||
}
|
||||
|
||||
func test_convert_links() throws {
|
||||
let helper = Markdown()
|
||||
let md = helper.process("prologue damus.io https://nostr.build epilogue")
|
||||
let expected = try AttributedString(markdown: "prologue [damus.io](https://damus.io) [https://nostr.build](https://nostr.build) epilogue", options: md_opts)
|
||||
XCTAssertEqual(md, expected)
|
||||
}
|
||||
|
||||
func test_convert_http() throws {
|
||||
let helper = Markdown()
|
||||
let md = helper.process("prologue http://example.com epilogue")
|
||||
let expected = try AttributedString(markdown: "prologue [http://example.com](http://example.com) epilogue", options: md_opts)
|
||||
XCTAssertEqual(md, expected)
|
||||
}
|
||||
|
||||
func test_convert_mailto() throws {
|
||||
let helper = Markdown()
|
||||
let md = helper.process("prologue test@example.com epilogue")
|
||||
let expected = try AttributedString(markdown: "prologue [test@example.com](mailto:test@example.com) epilogue", options: md_opts)
|
||||
XCTAssertEqual(md, expected)
|
||||
}
|
||||
|
||||
func test_convert_mailto_implicit() throws {
|
||||
let helper = Markdown()
|
||||
let md = helper.process("prologue mailto:test@example.com epilogue")
|
||||
let expected = try AttributedString(markdown: "prologue [mailto:test@example.com](mailto:test@example.com) epilogue", options: md_opts)
|
||||
XCTAssertEqual(md, expected)
|
||||
}
|
||||
|
||||
func test_parse_shrug() throws {
|
||||
let md = Markdown.parse(content: "¯\\_(ツ)_/¯")
|
||||
XCTAssertEqual(NSMutableAttributedString(md).string, "¯\\_(ツ)_/¯")
|
||||
}
|
||||
|
||||
func test_parse_backslash() throws {
|
||||
let md = Markdown.parse(content: "\\a")
|
||||
XCTAssertEqual(NSMutableAttributedString(md).string, "\\a")
|
||||
}
|
||||
|
||||
}
|
||||
@@ -114,7 +114,7 @@ class ReplyTests: XCTestCase {
|
||||
let tags: [[String]] = []
|
||||
let blocks = parse_note_content(content: content, tags: tags).blocks
|
||||
let post_blocks = parse_post_blocks(content: content)
|
||||
let post_tags = make_post_tags(post_blocks: post_blocks, tags: tags, silent_mentions: false)
|
||||
let post_tags = make_post_tags(post_blocks: post_blocks, tags: tags)
|
||||
let event_refs = interpret_event_refs(blocks: blocks, tags: tags)
|
||||
|
||||
XCTAssertEqual(event_refs.count, 0)
|
||||
|
||||
Reference in New Issue
Block a user