test: fix broken tests

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2024-04-05 11:13:04 -07:00
committed by Daniel D’Aquino
parent 744bf4bb07
commit 690e1347e0
23 changed files with 611 additions and 367 deletions

View File

@@ -16,7 +16,7 @@ class Bech32ObjectTests: XCTestCase {
func testTLVParsing_NeventHasRelaysNoAuthorNoKind_ValidContent() throws {
let content = "nevent1qqstna2yrezu5wghjvswqqculvvwxsrcvu7uc0f78gan4xqhvz49d9spr3mhxue69uhkummnw3ez6un9d3shjtn4de6x2argwghx6egpr4mhxue69uhkummnw3ez6ur4vgh8wetvd3hhyer9wghxuet5nxnepm"
let expectedNoteIDHex = "b9f5441e45ca39179320e0031cfb18e34078673dcc3d3e3a3b3a981760aa5696"
let relays = ["wss://nostr-relay.untethr.me", "wss://nostr-pub.wellorder.net"]
let relays = ["wss://nostr-relay.untethr.me", "wss://nostr-pub.wellorder.net"].compactMap(RelayURL.init)
guard let noteid = hex_decode_noteid(expectedNoteIDHex) else {
XCTFail("Parsing note ID failed")
return
@@ -34,7 +34,7 @@ class Bech32ObjectTests: XCTestCase {
func testTLVParsing_NeventHasRelaysNoAuthorHasKind_ValidContent() throws {
let content = "nevent1qqstna2yrezu5wghjvswqqculvvwxsrcvu7uc0f78gan4xqhvz49d9spr3mhxue69uhkummnw3ez6un9d3shjtn4de6x2argwghx6egpr4mhxue69uhkummnw3ez6ur4vgh8wetvd3hhyer9wghxuet5qvzqqqqqqyjyqz7d"
let expectedNoteIDHex = "b9f5441e45ca39179320e0031cfb18e34078673dcc3d3e3a3b3a981760aa5696"
let relays = ["wss://nostr-relay.untethr.me", "wss://nostr-pub.wellorder.net"]
let relays = ["wss://nostr-relay.untethr.me", "wss://nostr-pub.wellorder.net"].compactMap(RelayURL.init)
guard let noteid = hex_decode_noteid(expectedNoteIDHex) else {
XCTFail("Parsing note ID failed")
return
@@ -53,7 +53,7 @@ class Bech32ObjectTests: XCTestCase {
let content = "nevent1qqstna2yrezu5wghjvswqqculvvwxsrcvu7uc0f78gan4xqhvz49d9spr3mhxue69uhkummnw3ez6un9d3shjtn4de6x2argwghx6egpr4mhxue69uhkummnw3ez6ur4vgh8wetvd3hhyer9wghxuet5qgsrhuxx8l9ex335q7he0f09aej04zpazpl0ne2cgukyawd24mayt8grqsqqqqqpw4032x"
let expectedNoteIDHex = "b9f5441e45ca39179320e0031cfb18e34078673dcc3d3e3a3b3a981760aa5696"
let relays = ["wss://nostr-relay.untethr.me", "wss://nostr-pub.wellorder.net"]
let relays = ["wss://nostr-relay.untethr.me", "wss://nostr-pub.wellorder.net"].compactMap(RelayURL.init)
guard let noteid = hex_decode_noteid(expectedNoteIDHex) else {
XCTFail("Parsing note ID failed")
return
@@ -78,8 +78,8 @@ class Bech32ObjectTests: XCTestCase {
XCTFail()
return
}
let relays = ["wss://r.x.com", "wss://djbas.sadkb.com"]
let relays = ["wss://r.x.com", "wss://djbas.sadkb.com"].compactMap(RelayURL.init)
let expectedObject = Bech32Object.nprofile(NProfile(author: Pubkey(author.data), relays: relays))
guard let actualObject = Bech32Object.parse(content) else {
XCTFail("Invalid Object")
@@ -106,7 +106,7 @@ class Bech32ObjectTests: XCTestCase {
XCTFail("Can't decode npub")
return
}
let relays = ["wss://relay.nostr.band"]
let relays = ["wss://relay.nostr.band"].compactMap(RelayURL.init)
let identifier = "1700730909108"
let kind: UInt32 = 30023
@@ -122,8 +122,8 @@ class Bech32ObjectTests: XCTestCase {
return
}
let relays = ["wss://nostr-relay.untethr.me", "wss://nostr-pub.wellorder.net"]
let relays = ["wss://nostr-relay.untethr.me", "wss://nostr-pub.wellorder.net"].compactMap(RelayURL.init)
let expectedEncoding = "nevent1qqstna2yrezu5wghjvswqqculvvwxsrcvu7uc0f78gan4xqhvz49d9spr3mhxue69uhkummnw3ez6un9d3shjtn4de6x2argwghx6egpr4mhxue69uhkummnw3ez6ur4vgh8wetvd3hhyer9wghxuet5nxnepm"
let actualEncoding = Bech32Object.encode(.nevent(NEvent(noteid: noteid, relays: relays)))
@@ -140,8 +140,8 @@ class Bech32ObjectTests: XCTestCase {
let relays = [
"wss://nostr-relay.untethr.me",
"wss://nostr-pub.wellorder.net"
]
].compactMap(RelayURL.init)
let expectedEncoding = "nevent1qqstna2yrezu5wghjvswqqculvvwxsrcvu7uc0f78gan4xqhvz49d9spr3mhxue69uhkummnw3ez6un9d3shjtn4de6x2argwghx6egpr4mhxue69uhkummnw3ez6ur4vgh8wetvd3hhyer9wghxuet5qvzqqqqqqyjyqz7d"
let actualEncoding = Bech32Object.encode(.nevent(NEvent(noteid: noteid, relays: relays, kind: 1)))
@@ -159,8 +159,8 @@ class Bech32ObjectTests: XCTestCase {
return
}
let relays = ["wss://nostr-relay.untethr.me", "wss://nostr-pub.wellorder.net"]
let relays = ["wss://nostr-relay.untethr.me", "wss://nostr-pub.wellorder.net"].compactMap(RelayURL.init)
let expectedEncoding = "nevent1qqstna2yrezu5wghjvswqqculvvwxsrcvu7uc0f78gan4xqhvz49d9spr3mhxue69uhkummnw3ez6un9d3shjtn4de6x2argwghx6egpr4mhxue69uhkummnw3ez6ur4vgh8wetvd3hhyer9wghxuet5qgsrhuxx8l9ex335q7he0f09aej04zpazpl0ne2cgukyawd24mayt8grqsqqqqqpw4032x"
let actualEncoding = Bech32Object.encode(.nevent(NEvent(noteid: noteid, relays: relays, author: Pubkey(author.data), kind: 1)))
@@ -194,8 +194,8 @@ class Bech32ObjectTests: XCTestCase {
let relays = [
"wss://r.x.com",
"wss://djbas.sadkb.com"
]
].compactMap(RelayURL.init)
let expectedEncoding = "nprofile1qqsrhuxx8l9ex335q7he0f09aej04zpazpl0ne2cgukyawd24mayt8gpp4mhxue69uhhytnc9e3k7mgpz4mhxue69uhkg6nzv9ejuumpv34kytnrdaksjlyr9p"
let actualEncoding = Bech32Object.encode(.nprofile(NProfile(author: Pubkey(author.data), relays: relays)))
@@ -219,7 +219,7 @@ class Bech32ObjectTests: XCTestCase {
return
}
let relays = ["wss://relay.nostr.band"]
let relays = ["wss://relay.nostr.band"].compactMap(RelayURL.init)
let identifier = "1700730909108"
let kind: UInt32 = 30023