Fix nostr: mention prefix bugs

The zero-width space was causing parsing issues. Not sure why we need
this so I just removed it.

Changelog-Fixed: Fix nostr:nostr:... bugs
This commit is contained in:
William Casarin
2023-07-14 17:26:19 -07:00
parent 72a060c7b3
commit 139be9eef2
3 changed files with 25 additions and 22 deletions

View File

@@ -136,15 +136,21 @@ class ReplyTests: XCTestCase {
guard let hex_pk = bech32_pubkey_decode(pk) else {
return
}
let content = """
@\(pk)
@\(pk)
"""
let blocks = parse_mentions(content: content, tags: []).blocks
let profile = Profile(name: "jb55", display_name: "Will", about: nil, picture: nil, banner: nil, website: nil, lud06: nil, lud16: nil, nip05: nil, damus_donation: nil)
let post = user_tag_attr_string(profile: profile, pubkey: pk)
post.append(.init(string: "\n"))
post.append(user_tag_attr_string(profile: profile, pubkey: pk))
post.append(.init(string: "\n"))
let post_note = build_post(post: post, action: .posting(.none), uploadedMedias: [], references: [.p(hex_pk)])
let rendered = render_blocks(blocks: blocks)
let expected_render = "nostr:\(pk)\nnostr:\(pk)"
XCTAssertEqual(post_note.content, expected_render)
let blocks = parse_mentions(content: post_note.content, tags: []).blocks
let rendered = render_blocks(blocks: blocks)
XCTAssertEqual(rendered, expected_render)