Properly implement top-level tests and fix one test using the wrong Block conversion property
Closes: https://github.com/damus-io/damus/pull/1528 Reviewed-by: William Casarin <jb55@jb55.com> Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
committed by
William Casarin
parent
6ee0be40e9
commit
f6f7d13f12
@@ -41,7 +41,7 @@ class ReplyTests: XCTestCase {
|
|||||||
let blocks = parse_post_blocks(content: content)
|
let blocks = parse_post_blocks(content: content)
|
||||||
|
|
||||||
XCTAssertEqual(blocks.count, 1)
|
XCTAssertEqual(blocks.count, 1)
|
||||||
XCTAssertEqual(blocks[0].asString, "what @")
|
XCTAssertEqual(blocks[0].asText, "what @")
|
||||||
}
|
}
|
||||||
|
|
||||||
func testHashtagsInQuote() {
|
func testHashtagsInQuote() {
|
||||||
|
|||||||
@@ -159,8 +159,13 @@ class damusTests: XCTestCase {
|
|||||||
|
|
||||||
XCTAssertNotNil(parsed)
|
XCTAssertNotNil(parsed)
|
||||||
XCTAssertEqual(parsed.count, 2)
|
XCTAssertEqual(parsed.count, 2)
|
||||||
// XCTAssertEqual(parsed[0].is_url?.absoluteString, "https://jb55.com")
|
|
||||||
// XCTAssertEqual(parsed[1].is_text, " br")
|
let testURL = URL(string: "https://jb55.com")
|
||||||
|
XCTAssertNotNil(testURL)
|
||||||
|
|
||||||
|
XCTAssertEqual(parsed[0].asURL, testURL)
|
||||||
|
|
||||||
|
XCTAssertEqual(parsed[1].asText, " br")
|
||||||
}
|
}
|
||||||
|
|
||||||
func testNoParseUrlWithOnlyWhitespace() {
|
func testNoParseUrlWithOnlyWhitespace() {
|
||||||
@@ -168,15 +173,19 @@ class damusTests: XCTestCase {
|
|||||||
let parsed = parse_note_content(content: .content(testString,nil)).blocks
|
let parsed = parse_note_content(content: .content(testString,nil)).blocks
|
||||||
|
|
||||||
XCTAssertNotNil(parsed)
|
XCTAssertNotNil(parsed)
|
||||||
// XCTAssertEqual(parsed[0].is_text, testString)
|
XCTAssertFalse(parsed[0].isURL)
|
||||||
|
XCTAssertEqual(parsed[0].asText, testString)
|
||||||
}
|
}
|
||||||
|
|
||||||
func testNoParseUrlTrailingCharacters() {
|
func testNoParseUrlTrailingCharacters() {
|
||||||
let testString = "https://foo.bar, "
|
let testString = "https://foo.bar, "
|
||||||
let parsed = parse_note_content(content: .content(testString,nil)).blocks
|
let parsed = parse_note_content(content: .content(testString,nil)).blocks
|
||||||
|
|
||||||
|
let testURL = URL(string: "https://foo.bar")
|
||||||
|
XCTAssertNotNil(testURL)
|
||||||
|
|
||||||
XCTAssertNotNil(parsed)
|
XCTAssertNotNil(parsed)
|
||||||
// XCTAssertEqual(parsed[0].is_url?.absoluteString, "https://foo.bar")
|
XCTAssertEqual(parsed[0].asURL, testURL)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -210,7 +219,7 @@ class damusTests: XCTestCase {
|
|||||||
|
|
||||||
XCTAssertNotNil(parsed)
|
XCTAssertNotNil(parsed)
|
||||||
XCTAssertEqual(parsed.count, 1)
|
XCTAssertEqual(parsed.count, 1)
|
||||||
// XCTAssertEqual(parsed[0].is_text, "there is no mention here")
|
XCTAssertEqual(parsed[0].asText, "there is no mention here")
|
||||||
|
|
||||||
guard case .text(let txt) = parsed[0] else {
|
guard case .text(let txt) = parsed[0] else {
|
||||||
XCTAssertTrue(false)
|
XCTAssertTrue(false)
|
||||||
|
|||||||
Reference in New Issue
Block a user