1
0
mirror of git://jb55.com/damus synced 2024-09-18 19:23:49 +00:00

fix incredible bug lol

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin 2022-05-08 19:31:40 -07:00
parent 300463ef55
commit 812abba8d4
2 changed files with 18 additions and 1 deletions

View File

@ -137,7 +137,7 @@ func find_tag_ref(type: String, id: String, tags: [[String]]) -> Int? {
return i
}
}
i += i
i += 1
}
return nil

View File

@ -132,6 +132,23 @@ class ReplyTests: XCTestCase {
XCTAssertEqual(post_tags.tags[0][1], pk)
}
func testReplyMentions() throws {
let privkey = "0fc2092231f958f8d57d66f5e238bb45b6a2571f44c0ce024bbc6f3a9c8a15fe"
let pubkey = "30c6d1dc7f7c156794fa15055e651b758a61b99f50fcf759de59386050bf6ae2"
let refs = [
ReferencedId(ref_id: "thread_id", relay_id: nil, key: "e"),
ReferencedId(ref_id: "reply_id", relay_id: nil, key: "e"),
ReferencedId(ref_id: pubkey, relay_id: nil, key: "p"),
]
let post = NostrPost(content: "this is a (@\(pubkey)) mention", references: refs)
let ev = post_to_event(post: post, privkey: privkey, pubkey: pubkey)
XCTAssertEqual(ev.content, "this is a (#[2]) mention")
XCTAssertEqual(ev.tags[2][1], pubkey)
}
func testInvalidPostReference() throws {
let pk = "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e24"
let content = "this is a @\(pk) mention"