damus

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

commit f9d21ef901f91544fa91e27a01141b9a4c1d2f1a
parent a08d0a5a19680cfeb5639c8857b11e4ab9533dae
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 31 Jul 2023 04:05:09 -0700

test: rename test_event to test_note

Diffstat:
Mdamus/Components/ImageCarousel.swift | 2+-
Mdamus/Components/TranslateView.swift | 2+-
Mdamus/Components/UserView.swift | 2+-
Mdamus/Components/ZapButton.swift | 4++--
Mdamus/TestData.swift | 12++++++------
Mdamus/Views/ActionBar/EventActionBar.swift | 10+++++-----
Mdamus/Views/ActionBar/RepostAction.swift | 2+-
Mdamus/Views/EventView.swift | 2+-
Mdamus/Views/Events/BuilderEventView.swift | 2+-
Mdamus/Views/Events/Components/EventTop.swift | 2+-
Mdamus/Views/Events/Components/ReplyDescription.swift | 2+-
Mdamus/Views/Events/Components/ReplyPart.swift | 2+-
Mdamus/Views/Events/EventBody.swift | 2+-
Mdamus/Views/Events/EventProfile.swift | 2+-
Mdamus/Views/Events/EventShell.swift | 4++--
Mdamus/Views/Events/MutedEventView.swift | 2+-
Mdamus/Views/Events/SelectedEventView.swift | 2+-
Mdamus/Views/Events/TextEvent.swift | 4++--
Mdamus/Views/Events/WideEventView.swift | 2+-
Mdamus/Views/Muting/MutelistView.swift | 2+-
Mdamus/Views/NoteContentView.swift | 2+-
Mdamus/Views/Notifications/EventGroupView.swift | 4++--
Mdamus/Views/Notifications/NotificationItemView.swift | 2+-
Mdamus/Views/Notifications/ProfilePicturesView.swift | 3++-
Mdamus/Views/Profile/EventProfileName.swift | 2+-
Mdamus/Views/Profile/ProfileNameView.swift | 6+++---
Mdamus/Views/Profile/ProfilePicView.swift | 8++++----
Mdamus/Views/QRCodeView.swift | 2+-
Mdamus/Views/ReactionsView.swift | 2+-
Mdamus/Views/ReplyView.swift | 2+-
Mdamus/Views/Reposts/RepostedEvent.swift | 2+-
Mdamus/Views/RepostsView.swift | 2+-
Mdamus/Views/Search/SearchingEventView.swift | 2+-
Mdamus/Views/ThreadView.swift | 2+-
Mdamus/Views/Zaps/CustomizeZapView.swift | 2+-
MdamusTests/EventGroupViewTests.swift | 16++++++++--------
MdamusTests/UserSearchCacheTests.swift | 4++--
37 files changed, 64 insertions(+), 63 deletions(-)

diff --git a/damus/Components/ImageCarousel.swift b/damus/Components/ImageCarousel.swift @@ -289,7 +289,7 @@ public struct ImageFill { struct ImageCarousel_Previews: PreviewProvider { static var previews: some View { let url: MediaUrl = .image(URL(string: "https://jb55.com/red-me.jpg")!) - ImageCarousel(state: test_damus_state(), evid: "evid", urls: [url, url]) + ImageCarousel(state: test_damus_state(), evid: test_note.id, urls: [url, url]) } } diff --git a/damus/Components/TranslateView.swift b/damus/Components/TranslateView.swift @@ -121,7 +121,7 @@ extension View { struct TranslateView_Previews: PreviewProvider { static var previews: some View { let ds = test_damus_state() - TranslateView(damus_state: ds, event: test_event, size: .normal) + TranslateView(damus_state: ds, event: test_note, size: .normal) } } diff --git a/damus/Components/UserView.swift b/damus/Components/UserView.swift @@ -56,6 +56,6 @@ struct UserView: View { struct UserView_Previews: PreviewProvider { static var previews: some View { - UserView(damus_state: test_damus_state(), pubkey: "pk") + UserView(damus_state: test_damus_state(), pubkey: test_note.pubkey) } } diff --git a/damus/Components/ZapButton.swift b/damus/Components/ZapButton.swift @@ -141,10 +141,10 @@ struct ZapButton: View { struct ZapButton_Previews: PreviewProvider { static var previews: some View { - let pending_zap = PendingZap(amount_msat: 1000, target: ZapTarget.note(id: "noteid", author: "author"), request: .normal(test_zap_request), type: .pub, state: .external(.init(state: .fetching_invoice))) + let pending_zap = PendingZap(amount_msat: 1000, target: ZapTarget.note(id: test_note.id, author: test_note.pubkey), request: .normal(test_zap_request), type: .pub, state: .external(.init(state: .fetching_invoice))) let zaps = ZapsDataModel([.pending(pending_zap)]) - ZapButton(damus_state: test_damus_state(), target: ZapTarget.note(id: test_event.id, author: test_event.pubkey), lnurl: "lnurl", zaps: zaps) + ZapButton(damus_state: test_damus_state(), target: ZapTarget.note(id: test_note.id, author: test_note.pubkey), lnurl: "lnurl", zaps: zaps) } } diff --git a/damus/TestData.swift b/damus/TestData.swift @@ -12,9 +12,9 @@ let test_pubkey = "a9952fe066ced622167acb8069a0dfd1d44d9493ef2a4c28cf93e2877248b let test_keypair = Keypair(pubkey: test_pubkey, privkey: test_seckey) let test_keypair_full = test_keypair.to_full()! -let test_event_holder = EventHolder(events: [], incoming: [test_event]) +let test_event_holder = EventHolder(events: [], incoming: [test_note]) -let test_event = +let test_note = NostrEvent( content: "hello there https://jb55.com/s/Oct12-150217.png https://jb55.com/red-me.jpg cool", keypair: test_keypair, @@ -32,18 +32,18 @@ let test_event_group = EventGroup(events: test_reposts) let test_zap_invoice = ZapInvoice(description: .description("description"), amount: 10000, string: "lnbc1", expiry: 1000000, payment_hash: Data(), created_at: 1000000) let test_zap_request_ev = NostrEvent(content: "hi", keypair: test_keypair, kind: 9734)! let test_zap_request = ZapRequest(ev: test_zap_request_ev) -let test_zap = Zap(event: test_event, invoice: test_zap_invoice, zapper: "zapper", target: .profile("pk"), raw_request: test_zap_request, is_anon: false, private_request: nil) +let test_zap = Zap(event: test_note, invoice: test_zap_invoice, zapper: test_note.pubkey, target: .profile(test_pubkey), raw_request: test_zap_request, is_anon: false, private_request: nil) -let test_private_zap = Zap(event: test_event, invoice: test_zap_invoice, zapper: "zapper", target: .profile("pk"), raw_request: test_zap_request, is_anon: false, private_request: .init(ev: test_event)) +let test_private_zap = Zap(event: test_note, invoice: test_zap_invoice, zapper: test_note.pubkey, target: .profile(test_pubkey), raw_request: test_zap_request, is_anon: false, private_request: .init(ev: test_note)) -let test_pending_zap = PendingZap(amount_msat: 10000, target: .note(id: "id", author: "pk"), request: .normal(test_zap_request), type: .pub, state: .external(.init(state: .fetching_invoice))) +let test_pending_zap = PendingZap(amount_msat: 10000, target: .note(id: test_note.id, author: test_note.pubkey), request: .normal(test_zap_request), type: .pub, state: .external(.init(state: .fetching_invoice))) func test_damus_state() -> DamusState { let damus = DamusState.empty let prof = Profile(name: "damus", display_name: "damus", about: "iOS app!", picture: "https://damus.io/img/logo.png", banner: "", website: "https://damus.io", lud06: nil, lud16: "jb55@sendsats.lol", nip05: "damus.io", damus_donation: nil) - let tsprof = TimestampedProfile(profile: prof, timestamp: 0, event: test_event) + let tsprof = TimestampedProfile(profile: prof, timestamp: 0, event: test_note) damus.profiles.add(id: test_pubkey, profile: tsprof) return damus } diff --git a/damus/Views/ActionBar/EventActionBar.swift b/damus/Views/ActionBar/EventActionBar.swift @@ -349,11 +349,11 @@ struct EventActionBar_Previews: PreviewProvider { let bar = ActionBarModel.empty() let likedbar = ActionBarModel(likes: 10, boosts: 0, zaps: 0, zap_total: 0, replies: 0, our_like: nil, our_boost: nil, our_zap: nil, our_reply: nil) - let likedbar_ours = ActionBarModel(likes: 10, boosts: 0, zaps: 0, zap_total: 0, replies: 0, our_like: test_event, our_boost: nil, our_zap: nil, our_reply: nil) - let maxed_bar = ActionBarModel(likes: 999, boosts: 999, zaps: 999, zap_total: 99999999, replies: 999, our_like: test_event, our_boost: test_event, our_zap: nil, our_reply: nil) - let extra_max_bar = ActionBarModel(likes: 9999, boosts: 9999, zaps: 9999, zap_total: 99999999, replies: 9999, our_like: test_event, our_boost: test_event, our_zap: nil, our_reply: test_event) - let mega_max_bar = ActionBarModel(likes: 9999999, boosts: 99999, zaps: 9999, zap_total: 99999999, replies: 9999999, our_like: test_event, our_boost: test_event, our_zap: .zap(test_zap), our_reply: test_event) - + let likedbar_ours = ActionBarModel(likes: 10, boosts: 0, zaps: 0, zap_total: 0, replies: 0, our_like: test_note, our_boost: nil, our_zap: nil, our_reply: nil) + let maxed_bar = ActionBarModel(likes: 999, boosts: 999, zaps: 999, zap_total: 99999999, replies: 999, our_like: test_note, our_boost: test_note, our_zap: nil, our_reply: nil) + let extra_max_bar = ActionBarModel(likes: 9999, boosts: 9999, zaps: 9999, zap_total: 99999999, replies: 9999, our_like: test_note, our_boost: test_note, our_zap: nil, our_reply: test_note) + let mega_max_bar = ActionBarModel(likes: 9999999, boosts: 99999, zaps: 9999, zap_total: 99999999, replies: 9999999, our_like: test_note, our_boost: test_note, our_zap: .zap(test_zap), our_reply: test_note) + VStack(spacing: 50) { EventActionBar(damus_state: ds, event: ev, bar: bar) diff --git a/damus/Views/ActionBar/RepostAction.swift b/damus/Views/ActionBar/RepostAction.swift @@ -61,6 +61,6 @@ struct RepostAction: View { struct RepostAction_Previews: PreviewProvider { static var previews: some View { - RepostAction(damus_state: test_damus_state(), event: test_event) + RepostAction(damus_state: test_damus_state(), event: test_note) } } diff --git a/damus/Views/EventView.swift b/damus/Views/EventView.swift @@ -143,7 +143,7 @@ struct EventView_Previews: PreviewProvider { */ - EventView( damus: test_damus_state(), event: test_event ) + EventView( damus: test_damus_state(), event: test_note ) EventView( damus: test_damus_state(), event: test_longform_event.event, options: [.wide] ) } diff --git a/damus/Views/Events/BuilderEventView.swift b/damus/Views/Events/BuilderEventView.swift @@ -93,7 +93,7 @@ struct BuilderEventView: View { struct BuilderEventView_Previews: PreviewProvider { static var previews: some View { - BuilderEventView(damus: test_damus_state(), event_id: "536bee9e83c818e3b82c101935128ae27a0d4290039aaf253efe5f09232c1962") + BuilderEventView(damus: test_damus_state(), event_id: test_note.id) } } diff --git a/damus/Views/Events/Components/EventTop.swift b/damus/Views/Events/Components/EventTop.swift @@ -41,6 +41,6 @@ struct EventTop: View { struct EventTop_Previews: PreviewProvider { static var previews: some View { - EventTop(state: test_damus_state(), event: test_event, pubkey: test_event.pubkey, is_anon: false) + EventTop(state: test_damus_state(), event: test_note, pubkey: test_note.pubkey, is_anon: false) } } diff --git a/damus/Views/Events/Components/ReplyDescription.swift b/damus/Views/Events/Components/ReplyDescription.swift @@ -22,7 +22,7 @@ struct ReplyDescription: View { struct ReplyDescription_Previews: PreviewProvider { static var previews: some View { - ReplyDescription(event: test_event, profiles: test_damus_state().profiles) + ReplyDescription(event: test_note, profiles: test_damus_state().profiles) } } diff --git a/damus/Views/Events/Components/ReplyPart.swift b/damus/Views/Events/Components/ReplyPart.swift @@ -25,6 +25,6 @@ struct ReplyPart: View { struct ReplyPart_Previews: PreviewProvider { static var previews: some View { - ReplyPart(event: test_event, privkey: nil, profiles: test_damus_state().profiles) + ReplyPart(event: test_note, privkey: nil, profiles: test_damus_state().profiles) } } diff --git a/damus/Views/Events/EventBody.swift b/damus/Views/Events/EventBody.swift @@ -43,6 +43,6 @@ struct EventBody: View { struct EventBody_Previews: PreviewProvider { static var previews: some View { - EventBody(damus_state: test_damus_state(), event: test_event, size: .normal, options: []) + EventBody(damus_state: test_damus_state(), event: test_note, size: .normal, options: []) } } diff --git a/damus/Views/Events/EventProfile.swift b/damus/Views/Events/EventProfile.swift @@ -51,6 +51,6 @@ struct EventProfile: View { struct EventProfile_Previews: PreviewProvider { static var previews: some View { - EventProfile(damus_state: test_damus_state(), pubkey: "pk", profile: nil, size: .normal) + EventProfile(damus_state: test_damus_state(), pubkey: test_note.pubkey, profile: nil, size: .normal) } } diff --git a/damus/Views/Events/EventShell.swift b/damus/Views/Events/EventShell.swift @@ -133,11 +133,11 @@ struct EventShell_Previews: PreviewProvider { static var previews: some View { VStack { - EventShell(state: test_damus_state(), event: test_event, options: [.no_action_bar]) { + EventShell(state: test_damus_state(), event: test_note, options: [.no_action_bar]) { Text(verbatim: "Hello") } - EventShell(state: test_damus_state(), event: test_event, options: [.no_action_bar, .wide]) { + EventShell(state: test_damus_state(), event: test_note, options: [.no_action_bar, .wide]) { Text(verbatim: "Hello") } } diff --git a/damus/Views/Events/MutedEventView.swift b/damus/Views/Events/MutedEventView.swift @@ -77,7 +77,7 @@ struct MutedEventView_Previews: PreviewProvider { static var previews: some View { - MutedEventView(damus_state: test_damus_state(), event: test_event, selected: false) + MutedEventView(damus_state: test_damus_state(), event: test_note, selected: false) .frame(width: .infinity, height: 50) } } diff --git a/damus/Views/Events/SelectedEventView.swift b/damus/Views/Events/SelectedEventView.swift @@ -86,6 +86,6 @@ struct SelectedEventView: View { struct SelectedEventView_Previews: PreviewProvider { static var previews: some View { - SelectedEventView(damus: test_damus_state(), event: test_event, size: .selected) + SelectedEventView(damus: test_damus_state(), event: test_note, size: .selected) } } diff --git a/damus/Views/Events/TextEvent.swift b/damus/Views/Events/TextEvent.swift @@ -75,10 +75,10 @@ func event_is_anonymous(ev: NostrEvent) -> Bool { struct TextEvent_Previews: PreviewProvider { static var previews: some View { VStack(spacing: 20) { - TextEvent(damus: test_damus_state(), event: test_event, pubkey: "pk", options: []) + TextEvent(damus: test_damus_state(), event: test_note, pubkey: test_pubkey, options: []) .frame(height: 400) - TextEvent(damus: test_damus_state(), event: test_event, pubkey: "pk", options: [.wide]) + TextEvent(damus: test_damus_state(), event: test_note, pubkey: test_pubkey, options: [.wide]) .frame(height: 400) } } diff --git a/damus/Views/Events/WideEventView.swift b/damus/Views/Events/WideEventView.swift @@ -17,6 +17,6 @@ struct WideEventView: View { struct WideEventView_Previews: PreviewProvider { static var previews: some View { - WideEventView(event: test_event) + WideEventView(event: test_note) } } diff --git a/damus/Views/Muting/MutelistView.swift b/damus/Views/Muting/MutelistView.swift @@ -68,6 +68,6 @@ func get_mutelist_users(_ mlist: NostrEvent?) -> [String] { struct MutelistView_Previews: PreviewProvider { static var previews: some View { - MutelistView(damus_state: test_damus_state(), users: [test_event.pubkey, test_event.pubkey+"hi"]) + MutelistView(damus_state: test_damus_state(), users: [test_note.pubkey, test_note.pubkey]) } } diff --git a/damus/Views/NoteContentView.swift b/damus/Views/NoteContentView.swift @@ -601,7 +601,7 @@ struct NoteContentView_Previews: PreviewProvider { let state = test_damus_state() VStack { - NoteContentView(damus_state: state, event: test_event, show_images: true, size: .normal, options: []) + NoteContentView(damus_state: state, event: test_note, show_images: true, size: .normal, options: []) NoteContentView(damus_state: state, event: test_longform_event.event, show_images: true, size: .normal, options: [.wide]) .border(Color.red) diff --git a/damus/Views/Notifications/EventGroupView.swift b/damus/Views/Notifications/EventGroupView.swift @@ -261,11 +261,11 @@ struct EventGroupView: View { struct EventGroupView_Previews: PreviewProvider { static var previews: some View { VStack { - EventGroupView(state: test_damus_state(), event: test_event, group: .repost(test_event_group)) + EventGroupView(state: test_damus_state(), event: test_note, group: .repost(test_event_group)) .frame(height: 200) .padding() - EventGroupView(state: test_damus_state(), event: test_event, group: .reaction(test_event_group)) + EventGroupView(state: test_damus_state(), event: test_note, group: .reaction(test_event_group)) .frame(height: 200) .padding() } diff --git a/damus/Views/Notifications/NotificationItemView.swift b/damus/Views/Notifications/NotificationItemView.swift @@ -84,7 +84,7 @@ struct NotificationItemView: View { } } -let test_notification_item: NotificationItem = .repost("evid", test_event_group) +let test_notification_item: NotificationItem = .repost(test_note.id, test_event_group) struct NotificationItemView_Previews: PreviewProvider { static var previews: some View { diff --git a/damus/Views/Notifications/ProfilePicturesView.swift b/damus/Views/Notifications/ProfilePicturesView.swift @@ -25,6 +25,7 @@ struct ProfilePicturesView: View { struct ProfilePicturesView_Previews: PreviewProvider { static var previews: some View { - ProfilePicturesView(state: test_damus_state(), pubkeys: ["a", "b"]) + let pubkey = test_note.pubkey + ProfilePicturesView(state: test_damus_state(), pubkeys: [pubkey, pubkey]) } } diff --git a/damus/Views/Profile/EventProfileName.swift b/damus/Views/Profile/EventProfileName.swift @@ -106,6 +106,6 @@ struct EventProfileName: View { struct EventProfileName_Previews: PreviewProvider { static var previews: some View { - EventProfileName(pubkey: "pk", profile: nil, damus: test_damus_state()) + EventProfileName(pubkey: test_note.pubkey, profile: nil, damus: test_damus_state()) } } diff --git a/damus/Views/Profile/ProfileNameView.swift b/damus/Views/Profile/ProfileNameView.swift @@ -54,9 +54,9 @@ struct ProfileNameView: View { struct ProfileNameView_Previews: PreviewProvider { static var previews: some View { VStack { - ProfileNameView(pubkey: test_event.pubkey, profile: nil, follows_you: true, damus: test_damus_state()) - - ProfileNameView(pubkey: test_event.pubkey, profile: nil, follows_you: false, damus: test_damus_state()) + ProfileNameView(pubkey: test_note.pubkey, profile: nil, follows_you: true, damus: test_damus_state()) + + ProfileNameView(pubkey: test_note.pubkey, profile: nil, follows_you: false, damus: test_damus_state()) } } } diff --git a/damus/Views/Profile/ProfilePicView.swift b/damus/Views/Profile/ProfilePicView.swift @@ -106,19 +106,19 @@ func get_profile_url(picture: String?, pubkey: String, profiles: Profiles) -> UR return URL(string: robohash(pubkey))! } -func make_preview_profiles(_ pubkey: String) -> Profiles { +func make_preview_profiles(_ pubkey: Pubkey) -> Profiles { let user_search_cache = UserSearchCache() let profiles = Profiles(user_search_cache: user_search_cache) let picture = "http://cdn.jb55.com/img/red-me.jpg" let profile = Profile(name: "jb55", display_name: "William Casarin", about: "It's me", picture: picture, banner: "", website: "https://jb55.com", lud06: nil, lud16: nil, nip05: "jb55.com", damus_donation: nil) - let ts_profile = TimestampedProfile(profile: profile, timestamp: 0, event: test_event) + let ts_profile = TimestampedProfile(profile: profile, timestamp: 0, event: test_note) profiles.add(id: pubkey, profile: ts_profile) return profiles } struct ProfilePicView_Previews: PreviewProvider { - static let pubkey = "ca48854ac6555fed8e439ebb4fa2d928410e0eef13fa41164ec45aaaa132d846" - + static let pubkey = test_note.pubkey + static var previews: some View { ProfilePicView( pubkey: pubkey, diff --git a/damus/Views/QRCodeView.swift b/damus/Views/QRCodeView.swift @@ -297,7 +297,7 @@ struct QRCodeView: View { struct QRCodeView_Previews: PreviewProvider { static var previews: some View { - QRCodeView(damus_state: test_damus_state(), pubkey: test_event.pubkey) + QRCodeView(damus_state: test_damus_state(), pubkey: test_note.pubkey) } } diff --git a/damus/Views/ReactionsView.swift b/damus/Views/ReactionsView.swift @@ -38,6 +38,6 @@ struct ReactionsView: View { struct ReactionsView_Previews: PreviewProvider { static var previews: some View { let state = test_damus_state() - ReactionsView(damus_state: state, model: ReactionsModel(state: state, target: "pubkey")) + ReactionsView(damus_state: state, model: ReactionsModel(state: state, target: test_note.id)) } } diff --git a/damus/Views/ReplyView.swift b/damus/Views/ReplyView.swift @@ -81,7 +81,7 @@ struct ReplyView: View { struct ReplyView_Previews: PreviewProvider { static var previews: some View { VStack { - ReplyView(replying_to: test_event, damus: test_damus_state(), originalReferences: .constant([]), references: .constant([])) + ReplyView(replying_to: test_note, damus: test_damus_state(), originalReferences: .constant([]), references: .constant([])) .frame(height: 300) ReplyView(replying_to: test_longform_event.event, damus: test_damus_state(), originalReferences: .constant([]), references: .constant([])) diff --git a/damus/Views/Reposts/RepostedEvent.swift b/damus/Views/Reposts/RepostedEvent.swift @@ -31,6 +31,6 @@ struct RepostedEvent: View { struct RepostedEvent_Previews: PreviewProvider { static var previews: some View { - RepostedEvent(damus: test_damus_state(), event: test_event, inner_ev: test_event, options: []) + RepostedEvent(damus: test_damus_state(), event: test_note, inner_ev: test_note, options: []) } } diff --git a/damus/Views/RepostsView.swift b/damus/Views/RepostsView.swift @@ -33,6 +33,6 @@ struct RepostsView: View { struct RepostsView_Previews: PreviewProvider { static var previews: some View { let state = test_damus_state() - RepostsView(damus_state: state, model: RepostsModel(state: state, target: "pubkey")) + RepostsView(damus_state: state, model: RepostsModel(state: state, target: test_note.id)) } } diff --git a/damus/Views/Search/SearchingEventView.swift b/damus/Views/Search/SearchingEventView.swift @@ -125,6 +125,6 @@ struct SearchingEventView: View { struct SearchingEventView_Previews: PreviewProvider { static var previews: some View { let state = test_damus_state() - SearchingEventView(state: state, evid: test_event.id, search_type: .event) + SearchingEventView(state: state, evid: test_note.id, search_type: .event) } } diff --git a/damus/Views/ThreadView.swift b/damus/Views/ThreadView.swift @@ -104,7 +104,7 @@ struct ThreadView: View { struct ThreadView_Previews: PreviewProvider { static var previews: some View { let state = test_damus_state() - let thread = ThreadModel(event: test_event, damus_state: state) + let thread = ThreadModel(event: test_note, damus_state: state) ThreadView(state: state, thread: thread) } } diff --git a/damus/Views/Zaps/CustomizeZapView.swift b/damus/Views/Zaps/CustomizeZapView.swift @@ -302,7 +302,7 @@ extension View { struct CustomizeZapView_Previews: PreviewProvider { static var previews: some View { - CustomizeZapView(state: test_damus_state(), target: ZapTarget.note(id: test_event.id, author: test_event.pubkey), lnurl: "") + CustomizeZapView(state: test_damus_state(), target: ZapTarget.note(id: test_note.id, author: test_note.pubkey), lnurl: "") .frame(width: 400, height: 600) } } diff --git a/damusTests/EventGroupViewTests.swift b/damusTests/EventGroupViewTests.swift @@ -56,16 +56,16 @@ final class EventGroupViewTests: XCTestCase { let repost2 = NostrEvent(content: encodedPost, keypair: pk2, kind: NostrKind.boost.rawValue, tags: [], createdAt: 1)! let repost3 = NostrEvent(content: encodedPost, keypair: pk3, kind: NostrKind.boost.rawValue, tags: [], createdAt: 1)! - XCTAssertEqual(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [])), ev: test_event, pubkeys: [], locale: enUsLocale), "??") - XCTAssertEqual(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1])), ev: test_event, pubkeys: [pk1.pubkey], locale: enUsLocale), "pk1:pk1 reposted a note you were tagged in") - XCTAssertEqual(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1, repost2])), ev: test_event, pubkeys: [pk1.pubkey, pk2.pubkey], locale: enUsLocale), "pk1:pk1 and pk2:pk2 reposted a note you were tagged in") - XCTAssertEqual(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1, repost2, repost2])), ev: test_event, pubkeys: [pk1.pubkey, pk2.pubkey, pk3.pubkey], locale: enUsLocale), "pk1:pk1 and 2 others reposted a note you were tagged in") + XCTAssertEqual(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [])), ev: test_note, pubkeys: [], locale: enUsLocale), "??") + XCTAssertEqual(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1])), ev: test_note, pubkeys: [pk1.pubkey], locale: enUsLocale), "pk1:pk1 reposted a note you were tagged in") + XCTAssertEqual(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1, repost2])), ev: test_note, pubkeys: [pk1.pubkey, pk2.pubkey], locale: enUsLocale), "pk1:pk1 and pk2:pk2 reposted a note you were tagged in") + XCTAssertEqual(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1, repost2, repost2])), ev: test_note, pubkeys: [pk1.pubkey, pk2.pubkey, pk3.pubkey], locale: enUsLocale), "pk1:pk1 and 2 others reposted a note you were tagged in") Bundle.main.localizations.map { Locale(identifier: $0) }.forEach { - XCTAssertNoThrow(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [])), ev: test_event, pubkeys: [], locale: $0), "??") - XCTAssertNoThrow(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1])), ev: test_event, pubkeys: [pk1.pubkey], locale: $0)) - XCTAssertNoThrow(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1, repost2])), ev: test_event, pubkeys: [pk1.pubkey, pk2.pubkey], locale: $0)) - XCTAssertNoThrow(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1, repost2, repost3])), ev: test_event, pubkeys: [pk1.pubkey, pk2.pubkey, pk3.pubkey], locale: $0)) + XCTAssertNoThrow(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [])), ev: test_note, pubkeys: [], locale: $0), "??") + XCTAssertNoThrow(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1])), ev: test_note, pubkeys: [pk1.pubkey], locale: $0)) + XCTAssertNoThrow(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1, repost2])), ev: test_note, pubkeys: [pk1.pubkey, pk2.pubkey], locale: $0)) + XCTAssertNoThrow(reacting_to_text(profiles: damusState.profiles, our_pubkey: damusState.pubkey, group: .repost(EventGroup(events: [repost1, repost2, repost3])), ev: test_note, pubkeys: [pk1.pubkey, pk2.pubkey, pk3.pubkey], locale: $0)) } } diff --git a/damusTests/UserSearchCacheTests.swift b/damusTests/UserSearchCacheTests.swift @@ -24,7 +24,7 @@ final class UserSearchCacheTests: XCTestCase { damusState.profiles.set_validated(pubkey, nip05: validatedNip05) let profile = Profile(name: "tyiu", display_name: "Terry Yiu", about: nil, picture: nil, banner: nil, website: nil, lud06: nil, lud16: nil, nip05: nip05, damus_donation: nil) - let timestampedProfile = TimestampedProfile(profile: profile, timestamp: 0, event: test_event) + let timestampedProfile = TimestampedProfile(profile: profile, timestamp: 0, event: test_note) damusState.profiles.add(id: pubkey, profile: timestampedProfile) // Lookup to synchronize access on profiles dictionary to avoid race conditions. @@ -56,7 +56,7 @@ final class UserSearchCacheTests: XCTestCase { damusState.profiles.set_validated(keypair.pubkey, nip05: NIP05.parse(newNip05)) let newProfile = Profile(name: "whoami", display_name: "T-DAWG", about: nil, picture: nil, banner: nil, website: nil, lud06: nil, lud16: nil, nip05: newNip05, damus_donation: nil) - let newTimestampedProfile = TimestampedProfile(profile: newProfile, timestamp: 1000, event: test_event) + let newTimestampedProfile = TimestampedProfile(profile: newProfile, timestamp: 1000, event: test_note) damusState.profiles.add(id: keypair.pubkey, profile: newTimestampedProfile) // Lookup to synchronize access on profiles dictionary to avoid race conditions.