damus

nostr ios client
git clone git://jb55.com/damus
Log | Files | Refs | README | LICENSE

commit fd5940717129295e7d1670a9423b5565f19a85ec
parent 9b759247ee715d77eb715dc949b2857f6e83c675
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 17 Jul 2023 08:59:25 -0700

test: fix old markdown tests

Diffstat:
Mdamus.xcodeproj/project.pbxproj | 4----
DdamusTests/MarkdownTests.swift | 87-------------------------------------------------------------------------------
MdamusTests/ReplyTests.swift | 2+-
3 files changed, 1 insertion(+), 92 deletions(-)

diff --git a/damus.xcodeproj/project.pbxproj b/damus.xcodeproj/project.pbxproj @@ -331,7 +331,6 @@ BA693074295D649800ADDB87 /* UserSettingsStore.swift in Sources */ = {isa = PBXBuildFile; fileRef = BA693073295D649800ADDB87 /* UserSettingsStore.swift */; }; BAB68BED29543FA3007BA466 /* SelectWalletView.swift in Sources */ = {isa = PBXBuildFile; fileRef = BAB68BEC29543FA3007BA466 /* SelectWalletView.swift */; }; D2277EEA2A089BD5006C3807 /* Router.swift in Sources */ = {isa = PBXBuildFile; fileRef = D2277EE92A089BD5006C3807 /* Router.swift */; }; - DD597CBD2963D85A00C64D32 /* MarkdownTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = DD597CBC2963D85A00C64D32 /* MarkdownTests.swift */; }; E4FA1C032A24BB7F00482697 /* SearchSettingsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E4FA1C022A24BB7F00482697 /* SearchSettingsView.swift */; }; E990020F2955F837003BBC5A /* EditMetadataView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E990020E2955F837003BBC5A /* EditMetadataView.swift */; }; E9E4ED0B295867B900DD7078 /* ThreadView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E9E4ED0A295867B900DD7078 /* ThreadView.swift */; }; @@ -818,7 +817,6 @@ BA693073295D649800ADDB87 /* UserSettingsStore.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UserSettingsStore.swift; sourceTree = "<group>"; }; BAB68BEC29543FA3007BA466 /* SelectWalletView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SelectWalletView.swift; sourceTree = "<group>"; }; D2277EE92A089BD5006C3807 /* Router.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Router.swift; sourceTree = "<group>"; }; - DD597CBC2963D85A00C64D32 /* MarkdownTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MarkdownTests.swift; sourceTree = "<group>"; }; E4FA1C022A24BB7F00482697 /* SearchSettingsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchSettingsView.swift; sourceTree = "<group>"; }; E990020E2955F837003BBC5A /* EditMetadataView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EditMetadataView.swift; sourceTree = "<group>"; }; E9E4ED0A295867B900DD7078 /* ThreadView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ThreadView.swift; sourceTree = "<group>"; }; @@ -1501,7 +1499,6 @@ 4C7D097D2A0C58B900943473 /* WalletConnectTests.swift */, F944F56C29EA9CB20067B3BF /* Models */, 50A50A8C29A09E1C00C01BE7 /* RequestTests.swift */, - DD597CBC2963D85A00C64D32 /* MarkdownTests.swift */, 4C90BD1B283AC38E008EE7EF /* Bech32Tests.swift */, 4C363A9F2828A8DD006E126D /* LikeTests.swift */, 4C363A9D2828A822006E126D /* ReplyTests.swift */, @@ -2137,7 +2134,6 @@ 3A30410129AB12AA008A0F29 /* EventGroupViewTests.swift in Sources */, 501F8C822A0224EB001AFC1D /* KeychainStorageTests.swift in Sources */, 3ACBCB78295FE5C70037388A /* TimeAgoTests.swift in Sources */, - DD597CBD2963D85A00C64D32 /* MarkdownTests.swift in Sources */, 4C4F14A72A2A61A30045A0B9 /* NostrScriptTests.swift in Sources */, 4C3EA67B28FF7B3900C48A62 /* InvoiceTests.swift in Sources */, 4C363A9E2828A822006E126D /* ReplyTests.swift in Sources */, diff --git a/damusTests/MarkdownTests.swift b/damusTests/MarkdownTests.swift @@ -1,87 +0,0 @@ -// -// MarkdownTests.swift -// damusTests -// -// Created by Lionello Lunesu on 2022-12-28. -// - -import XCTest -@testable import damus - -class MarkdownTests: XCTestCase { - let md_opts: AttributedString.MarkdownParsingOptions = - .init(interpretedSyntax: .inlineOnlyPreservingWhitespace) - - override func setUpWithError() throws { - // Put setup code here. This method is called before the invocation of each test method in the class. - } - - override func tearDownWithError() throws { - // Put teardown code here. This method is called after the invocation of each test method in the class. - } - - func test_convert_link() throws { - let helper = Markdown() - let md = helper.process("prologue https://nostr.build epilogue") - let expected = try AttributedString(markdown: "prologue [https://nostr.build](https://nostr.build) epilogue", options: md_opts) - XCTAssertEqual(md, expected) - } - - func test_convert_link_no_scheme() throws { - let helper = Markdown() - let md = helper.process("prologue damus.io epilogue") - let expected = try AttributedString(markdown: "prologue [damus.io](https://damus.io) epilogue", options: md_opts) - XCTAssertEqual(md, expected) - } - - func test_longform_rendering() throws { - let st = test_damus_state() - let artifacts = render_note_content(ev: test_longform_event.event, profiles: st.profiles, privkey: st.keypair.privkey) - - switch artifacts { - case .separated: - XCTAssert(false) - case .parts(let parts): - XCTAssertEqual(parts.parts.count, 1) - } - } - - func test_convert_links() throws { - let helper = Markdown() - let md = helper.process("prologue damus.io https://nostr.build epilogue") - let expected = try AttributedString(markdown: "prologue [damus.io](https://damus.io) [https://nostr.build](https://nostr.build) epilogue", options: md_opts) - XCTAssertEqual(md, expected) - } - - func test_convert_http() throws { - let helper = Markdown() - let md = helper.process("prologue http://example.com epilogue") - let expected = try AttributedString(markdown: "prologue [http://example.com](http://example.com) epilogue", options: md_opts) - XCTAssertEqual(md, expected) - } - - func test_convert_mailto() throws { - let helper = Markdown() - let md = helper.process("prologue test@example.com epilogue") - let expected = try AttributedString(markdown: "prologue [test@example.com](mailto:test@example.com) epilogue", options: md_opts) - XCTAssertEqual(md, expected) - } - - func test_convert_mailto_implicit() throws { - let helper = Markdown() - let md = helper.process("prologue mailto:test@example.com epilogue") - let expected = try AttributedString(markdown: "prologue [mailto:test@example.com](mailto:test@example.com) epilogue", options: md_opts) - XCTAssertEqual(md, expected) - } - - func test_parse_shrug() throws { - let md = Markdown.parse(content: "¯\\_(ツ)_/¯") - XCTAssertEqual(NSMutableAttributedString(md).string, "¯\\_(ツ)_/¯") - } - - func test_parse_backslash() throws { - let md = Markdown.parse(content: "\\a") - XCTAssertEqual(NSMutableAttributedString(md).string, "\\a") - } - -} diff --git a/damusTests/ReplyTests.swift b/damusTests/ReplyTests.swift @@ -114,7 +114,7 @@ class ReplyTests: XCTestCase { let tags: [[String]] = [] let blocks = parse_note_content(content: content, tags: tags).blocks let post_blocks = parse_post_blocks(content: content) - let post_tags = make_post_tags(post_blocks: post_blocks, tags: tags, silent_mentions: false) + let post_tags = make_post_tags(post_blocks: post_blocks, tags: tags) let event_refs = interpret_event_refs(blocks: blocks, tags: tags) XCTAssertEqual(event_refs.count, 0)