LongPostTests.swift (1379B)
1 // 2 // LongPostTests.swift 3 // damusTests 4 // 5 // Created by William Casarin on 2023-08-05. 6 // 7 8 import XCTest 9 @testable import damus 10 11 final class LongPostTests: XCTestCase { 12 13 override func setUpWithError() throws { 14 // Put setup code here. This method is called before the invocation of each test method in the class. 15 } 16 17 override func tearDownWithError() throws { 18 // Put teardown code here. This method is called after the invocation of each test method in the class. 19 } 20 21 func testLongPost() throws { 22 let contacts = Contacts(our_pubkey: test_keypair.pubkey) 23 let json = "[\"EVENT\",\"subid\",\(test_failing_nostr_report)]" 24 let resp = NostrResponse.owned_from_json(json: json) 25 26 XCTAssertNotNil(resp) 27 guard let resp, 28 case .event(let subid, let ev) = resp 29 else { 30 XCTAssertFalse(true) 31 return 32 } 33 34 XCTAssertEqual(subid, "subid") 35 XCTAssertTrue(ev.should_show_event) 36 XCTAssertTrue(!ev.too_big) 37 XCTAssertTrue(should_show_event(state: test_damus_state, ev: ev)) 38 XCTAssertTrue(validate_event(ev: ev) == .ok ) 39 } 40 41 func testPerformanceExample() throws { 42 // This is an example of a performance test case. 43 self.measure { 44 // Put the code you want to measure the time of here. 45 } 46 } 47 48 }