1
0
mirror of git://jb55.com/damus synced 2024-09-16 02:03:45 +00:00
damus/damusTests/LongPostTests.swift
William Casarin 69c7acea76 tests: add ndb support to tests
stops it from crashing
2023-09-21 09:10:06 -04:00

49 lines
1.4 KiB
Swift

//
// LongPostTests.swift
// damusTests
//
// Created by William Casarin on 2023-08-05.
//
import XCTest
@testable import damus
final class LongPostTests: 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 testLongPost() throws {
let contacts = Contacts(our_pubkey: test_keypair.pubkey)
let json = "[\"EVENT\",\"subid\",\(test_failing_nostr_report)]"
let resp = NostrResponse.owned_from_json(json: json)
XCTAssertNotNil(resp)
guard let resp,
case .event(let subid, let ev) = resp
else {
XCTAssertFalse(true)
return
}
XCTAssertEqual(subid, "subid")
XCTAssertTrue(ev.should_show_event)
XCTAssertTrue(!ev.too_big)
XCTAssertTrue(should_show_event(keypair: test_keypair, hellthreads: test_damus_state.muted_threads, contacts: contacts, ev: ev))
XCTAssertTrue(validate_event(ev: ev) == .ok )
}
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.
}
}
}