field_ios

In-the-field app for Radroots on iOS
git clone https://radroots.dev/git/field_ios.git
Log | Files | Refs | README | LICENSE

TeraTodayReconciliationFFITests.swift (1417B)


      1 import TeraKitBindings
      2 import XCTest
      3 
      4 final class TeraTodayReconciliationFFITests: XCTestCase {
      5   func testGeneratedReconciliationCarriesCurrentGenerationAndRejectsInvalidSelection() async throws {
      6     let fixture = try MediaOwnershipFixture()
      7     defer { fixture.remove() }
      8     let runtime = try await fixture.runtime()
      9     let context = FfiLocalNetworkRecord(
     10       schemaVersion: 1, id: "nearby", label: "Nearby", relayUrls: ["wss://relay.example"],
     11       locality: nil, followedAuthors: [], generation: 1
     12     )
     13     let page = try await runtime.phase1TodayPage(context: context, limit: 20, asOfUnixS: 1_900_000_000, cursor: nil, viewerTimeZone: "UTC")
     14     let current = try await runtime.phase1TodayReconcile(context: context, asOfUnixS: page.asOfUnixS, cardIds: [], expectedGeneration: page.projectionGeneration, viewerTimeZone: "UTC")
     15     XCTAssertEqual(current.projectionGeneration, page.projectionGeneration)
     16     XCTAssertEqual(current.items, page.items)
     17     XCTAssertNil(current.nextCursor)
     18     do {
     19       _ = try await runtime.phase1TodayReconcile(context: context, asOfUnixS: page.asOfUnixS, cardIds: [String(repeating: "a", count: 65)], expectedGeneration: nil, viewerTimeZone: "UTC")
     20       XCTFail("Invalid card identity must fail at the generated runtime boundary")
     21     } catch let TeraAppError.Failure(report) {
     22       XCTAssertFalse(report.code.isEmpty)
     23     }
     24     _ = try await runtime.shutdown()
     25   }
     26 }