← All repositories

crossmate

A collaborative crossword app for iPhone and iPad

git clone https://code.inqk.net/crossmate.git


Tests/Unit/SyncMonitorTests.swift (889B)

1import Foundation
2import Testing
3
4@testable import Crossmate
5
6@Suite("Sync monitor")
7@MainActor
8struct SyncMonitorTests {
9    @Test("Engine checkpoint clears stale last error")
10    func engineCheckpointClearsLastError() {
11        let monitor = SyncMonitor(log: EventLog())
12        monitor.recordError(
13            "freshen puzzle grid appeared",
14            NSError(
15                domain: "CKErrorDomain",
16                code: 26,
17                userInfo: [NSLocalizedDescriptionKey: "Zone does not exist"]
18            )
19        )
20
21        #expect(monitor.lastErrorPhase == "freshen puzzle grid appeared")
22        monitor.noteSuccess()
23
24        #expect(monitor.lastSuccessAt != nil)
25        #expect(monitor.lastErrorPhase == nil)
26        #expect(monitor.lastErrorDomain == nil)
27        #expect(monitor.lastErrorCode == nil)
28        #expect(monitor.lastErrorDescription == nil)
29    }
30}