mirror of
git://jb55.com/damus
synced 2024-09-16 02:03:45 +00:00
test: rename test_event to test_note
This commit is contained in:
parent
a08d0a5a19
commit
f9d21ef901
@ -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])
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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
|
||||
}
|
||||
|
@ -349,10 +349,10 @@ 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)
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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] )
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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: [])
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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")
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -17,6 +17,6 @@ struct WideEventView: View {
|
||||
|
||||
struct WideEventView_Previews: PreviewProvider {
|
||||
static var previews: some View {
|
||||
WideEventView(event: test_event)
|
||||
WideEventView(event: test_note)
|
||||
}
|
||||
}
|
||||
|
@ -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])
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
|
@ -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()
|
||||
}
|
||||
|
@ -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 {
|
||||
|
@ -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])
|
||||
}
|
||||
}
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
@ -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_note.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: false, damus: test_damus_state())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -106,18 +106,18 @@ 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(
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
@ -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([]))
|
||||
|
@ -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: [])
|
||||
}
|
||||
}
|
||||
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user