commit cfc21219d35b00053a516ab520441f3c8fde966c
parent f42bc2e91e034cec21fc531b7e4f68600c229757
Author: William Casarin <jb55@jb55.com>
Date: Wed, 4 May 2022 16:52:01 -0700
more mention parsing tests
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 22 insertions(+), 0 deletions(-)
diff --git a/damusTests/damusTests.swift b/damusTests/damusTests.swift
@@ -42,5 +42,27 @@ class damusTests: XCTestCase {
XCTAssertTrue(parsed[1].is_mention)
XCTAssertTrue(parsed[2].is_text)
}
+
+ func testParseMentionBlank() {
+ let parsed = parse_mentions(content: "", tags: [["e", "event_id"]])
+
+ XCTAssertNotNil(parsed)
+ XCTAssertEqual(parsed.count, 0)
+ }
+
+ func testParseMentionOnlyText() {
+ let parsed = parse_mentions(content: "there is no mention here", tags: [["e", "event_id"]])
+
+ XCTAssertNotNil(parsed)
+ XCTAssertEqual(parsed.count, 1)
+ XCTAssertTrue(parsed[0].is_text)
+
+ guard case .text(let txt) = parsed[0] else {
+ XCTAssertTrue(false)
+ return
+ }
+
+ XCTAssertEqual(txt, "there is no mention here")
+ }
}