mirror of
git://jb55.com/damus
synced 2024-09-19 11:43:44 +00:00
53 lines
1.5 KiB
Swift
53 lines
1.5 KiB
Swift
//
|
|
// NDBIterTests.swift
|
|
// damusTests
|
|
//
|
|
// Created by William Casarin on 2023-07-21.
|
|
//
|
|
|
|
import XCTest
|
|
@testable import damus
|
|
|
|
final class NdbTests: XCTestCase {
|
|
|
|
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_ndb_note() throws {
|
|
let note = NdbNote.owned_from_json(json: test_contact_list_json)
|
|
XCTAssertNotNil(note)
|
|
guard let note else { return }
|
|
|
|
let id = "20d0ff27d6fcb13de8366328c5b1a7af26bcac07f2e558fbebd5e9242e608c09"
|
|
let pubkey = "32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245"
|
|
XCTAssertEqual(hex_encode(note.id), id)
|
|
XCTAssertEqual(hex_encode(note.pubkey), pubkey)
|
|
|
|
XCTAssertEqual(note.owned_size, 59062)
|
|
XCTAssertEqual(note.kind, 3)
|
|
XCTAssertEqual(note.created_at, 1689904312)
|
|
XCTAssertEqual(note.tags().reduce(0, { sum, _ in sum + 1 }), 786)
|
|
|
|
//let tags = note.tags()
|
|
for tag in note.tags() {
|
|
for elem in tag {
|
|
print("test_ndb_iterator \(elem.string())")
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
func testPerformanceExample() throws {
|
|
// This is an example of a performance test case.
|
|
self.measure {
|
|
// Put the code you want to measure the time of here.
|
|
}
|
|
}
|
|
|
|
}
|