mirror of
git://jb55.com/damus
synced 2024-09-18 19:23:49 +00:00
test: add newline mention test
This is currently passing but it shouldn't be. This is because we are not testing the build_post function directly. We will do this soon.
This commit is contained in:
parent
7b73a54de5
commit
7fc270725f
@ -131,6 +131,29 @@ class ReplyTests: XCTestCase {
|
||||
XCTAssertEqual(mentions.count, 1)
|
||||
}
|
||||
|
||||
func testNewlineMentions() throws {
|
||||
let pk = "npub1xtscya34g58tk0z605fvr788k263gsu6cy9x0mhnm87echrgufzsevkk5s"
|
||||
guard let hex_pk = bech32_pubkey_decode(pk) else {
|
||||
return
|
||||
}
|
||||
let content = """
|
||||
@\(pk)
|
||||
@\(pk)
|
||||
"""
|
||||
|
||||
let blocks = parse_mentions(content: content, tags: []).blocks
|
||||
|
||||
let rendered = render_blocks(blocks: blocks)
|
||||
let expected_render = "nostr:\(pk)\nnostr:\(pk)"
|
||||
|
||||
XCTAssertEqual(rendered, expected_render)
|
||||
|
||||
XCTAssertEqual(blocks.count, 3)
|
||||
XCTAssertEqual(blocks[0].is_mention, .pubkey(hex_pk))
|
||||
XCTAssertEqual(blocks[1].is_text, "\n")
|
||||
XCTAssertEqual(blocks[2].is_mention, .pubkey(hex_pk))
|
||||
}
|
||||
|
||||
func testThreadedReply() throws {
|
||||
let content = "this is some content"
|
||||
let tags = [["e", "thread_id"], ["e", "reply_id"]]
|
||||
|
Loading…
Reference in New Issue
Block a user