openclaw/apps/macos/Tests/ClawdbotIPCTests/LowCoverageViewSmokeTests.swift
Jon Shapiro 92697edb7c fix(venice): add compat settings to prevent HTTP 400 errors
Venice's API doesn't support certain OpenAI-compatible parameters that
Clawdbot sends by default:

- `store`: Venice returns HTTP 400 with no body when this is present
- `developer` role: Not supported by Venice's API

This adds VENICE_COMPAT settings (supportsStore: false,
supportsDeveloperRole: false) to all Venice model definitions, both
from the static catalog and dynamically discovered models.

Fixes issues reported in PR #1666 where users experienced silent
failures (HTTP 400, no body) when using Venice models.

Co-authored-by: jonisjongithub <jonisjongithub@users.noreply.github.com>
Co-authored-by: Clawdbot <bot@clawd.bot>
2026-01-26 17:56:01 -08:00

100 lines
3.6 KiB
Swift

import AppKit
import ClawdbotProtocol
import SwiftUI
import Testing
@testable import Clawdbot
@Suite(.serialized)
@MainActor
struct LowCoverageViewSmokeTests {
@Test func contextMenuCardBuildsBody() {
let loading = ContextMenuCardView(rows: [], statusText: "Loading…", isLoading: true)
_ = loading.body
let empty = ContextMenuCardView(rows: [], statusText: nil, isLoading: false)
_ = empty.body
let withRows = ContextMenuCardView(rows: SessionRow.previewRows, statusText: nil, isLoading: false)
_ = withRows.body
}
@Test func settingsToggleRowBuildsBody() {
var flag = false
let binding = Binding(get: { flag }, set: { flag = $0 })
let view = SettingsToggleRow(title: "Enable", subtitle: "Detail", binding: binding)
_ = view.body
}
@Test func voiceWakeTestCardBuildsBodyAcrossStates() {
var state = VoiceWakeTestState.idle
var isTesting = false
let stateBinding = Binding(get: { state }, set: { state = $0 })
let testingBinding = Binding(get: { isTesting }, set: { isTesting = $0 })
_ = VoiceWakeTestCard(testState: stateBinding, isTesting: testingBinding, onToggle: {}).body
state = .hearing("hello")
_ = VoiceWakeTestCard(testState: stateBinding, isTesting: testingBinding, onToggle: {}).body
state = .detected("command")
isTesting = true
_ = VoiceWakeTestCard(testState: stateBinding, isTesting: testingBinding, onToggle: {}).body
state = .failed("No mic")
_ = VoiceWakeTestCard(testState: stateBinding, isTesting: testingBinding, onToggle: {}).body
}
@Test func agentEventsWindowBuildsBodyWithEvent() {
AgentEventStore.shared.clear()
let sample = ControlAgentEvent(
runId: "run-1",
seq: 1,
stream: "tool",
ts: Date().timeIntervalSince1970 * 1000,
data: ["phase": AnyCodable("start"), "name": AnyCodable("test")],
summary: nil)
AgentEventStore.shared.append(sample)
_ = AgentEventsWindow().body
AgentEventStore.shared.clear()
}
@Test func notifyOverlayPresentsAndDismisses() async {
let controller = NotifyOverlayController()
controller.present(title: "Hello", body: "World", autoDismissAfter: 0)
controller.present(title: "Updated", body: "Again", autoDismissAfter: 0)
controller.dismiss()
try? await Task.sleep(nanoseconds: 250_000_000)
}
@Test func visualEffectViewHostsInNSHostingView() {
let hosting = NSHostingView(rootView: VisualEffectView(material: .sidebar))
_ = hosting.fittingSize
hosting.rootView = VisualEffectView(material: .popover, emphasized: true)
_ = hosting.fittingSize
}
@Test func menuHostedItemHostsContent() {
let view = MenuHostedItem(width: 240, rootView: AnyView(Text("Menu")))
let hosting = NSHostingView(rootView: view)
_ = hosting.fittingSize
hosting.rootView = MenuHostedItem(width: 320, rootView: AnyView(Text("Updated")))
_ = hosting.fittingSize
}
@Test func dockIconManagerUpdatesVisibility() {
_ = NSApplication.shared
UserDefaults.standard.set(false, forKey: showDockIconKey)
DockIconManager.shared.updateDockVisibility()
DockIconManager.shared.temporarilyShowDock()
}
@Test func voiceWakeSettingsExercisesHelpers() {
VoiceWakeSettings.exerciseForTesting()
}
@Test func debugSettingsExercisesHelpers() async {
await DebugSettings.exerciseForTesting()
}
}