1
0
mirror of git://jb55.com/damus synced 2024-09-16 02:03:45 +00:00
damus/damusTests/LongPostTests.swift
Jon Marrs dd29e87146 test: pass keypair instead of privkey for test cases
Tests were not building due to recent changes in the Damus source code that replaced privkey with keypair. This patch extends those changes to the test cases, allowing the tests to build and pass.

Signed-off-by: Jon Marrs <jdmarrs@gmail.com>
Signed-off-by: William Casarin <jb55@jb55.com>
2023-08-31 08:52:28 -07: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.
}
}
}