test(ios): bump app coverage

This commit is contained in:
Peter Steinberger
2025-12-14 06:09:28 +00:00
parent 5e09aae4ca
commit e82ee731bf
2 changed files with 31 additions and 24 deletions

View File

@@ -0,0 +1,31 @@
import SwiftUI
import Testing
@testable import Clawdis
@Suite struct AppCoverageTests {
@Test @MainActor func nodeAppModelUpdatesBackgroundedState() {
let appModel = NodeAppModel()
appModel.setScenePhase(.background)
#expect(appModel.isBackgrounded == true)
appModel.setScenePhase(.inactive)
#expect(appModel.isBackgrounded == false)
appModel.setScenePhase(.active)
#expect(appModel.isBackgrounded == false)
}
@Test @MainActor func voiceWakeStartReportsUnsupportedOnSimulator() async {
let voiceWake = VoiceWakeManager()
voiceWake.isEnabled = true
await voiceWake.start()
#expect(voiceWake.isListening == false)
#expect(voiceWake.statusText.contains("Simulator"))
voiceWake.stop()
#expect(voiceWake.statusText == "Off")
}
}

View File

@@ -67,28 +67,4 @@ import UIKit
let root = VoiceWakeToast(command: "clawdis: do something")
_ = Self.host(root)
}
@Test @MainActor func rootCanvasBuildsAViewHierarchyAcrossBridgeStates() {
let appModel = NodeAppModel()
let bridgeController = BridgeConnectionController(appModel: appModel, startDiscovery: false)
let hostCanvas = {
_ = Self.host(
RootCanvas()
.environment(appModel)
.environment(appModel.voiceWake)
.environment(bridgeController))
}
hostCanvas()
appModel.bridgeStatusText = "Connecting…"
hostCanvas()
appModel.bridgeStatusText = "Error: disconnected"
hostCanvas()
appModel.bridgeServerName = "Mock Bridge"
hostCanvas()
}
}