Files
bot/apps/macos/Tests/BotIPCTests/CameraIPCTests.swift
zeekay 08582cc303 Rebrand OpenClaw → Hanzo Bot across entire codebase
Complete rename of all OpenClaw/OPENCLAW/openclaw references to
Hanzo Bot/BOT/bot naming convention:

- Env vars: OPENCLAW_* → BOT_* (18 patterns)
- Config: ~/.openclaw/ → ~/.bot/, openclaw.json → bot.json
- Packages: @openclaw/* → @hanzo/bot-*
- Domains: openclaw.ai → hanzo.bot
- Mobile: OpenClawKit → BotKit, bundle IDs ai.openclaw → ai.hanzo.bot
- mDNS: _openclaw-gw._tcp → _bot-gw._tcp
- Docker: CMD hanzo-bot.mjs, BOT_PREFER_PNPM, BOT_DOCKER_APT_PACKAGES
- CI: docker-release.yml adds :latest tag on main branch
2026-02-11 11:13:08 -08:00

62 lines
1.9 KiB
Swift

import BotIPC
import Foundation
import Testing
@Suite struct CameraIPCTests {
@Test func cameraSnapCodableRoundtrip() throws {
let req: Request = .cameraSnap(
facing: .front,
maxWidth: 640,
quality: 0.85,
outPath: "/tmp/test.jpg")
let data = try JSONEncoder().encode(req)
let decoded = try JSONDecoder().decode(Request.self, from: data)
switch decoded {
case let .cameraSnap(facing, maxWidth, quality, outPath):
#expect(facing == .front)
#expect(maxWidth == 640)
#expect(quality == 0.85)
#expect(outPath == "/tmp/test.jpg")
default:
Issue.record("expected cameraSnap, got \(decoded)")
}
}
@Test func cameraClipCodableRoundtrip() throws {
let req: Request = .cameraClip(
facing: .back,
durationMs: 3000,
includeAudio: false,
outPath: "/tmp/test.mp4")
let data = try JSONEncoder().encode(req)
let decoded = try JSONDecoder().decode(Request.self, from: data)
switch decoded {
case let .cameraClip(facing, durationMs, includeAudio, outPath):
#expect(facing == .back)
#expect(durationMs == 3000)
#expect(includeAudio == false)
#expect(outPath == "/tmp/test.mp4")
default:
Issue.record("expected cameraClip, got \(decoded)")
}
}
@Test func cameraClipDefaultsIncludeAudioToTrueWhenMissing() throws {
let json = """
{"type":"cameraClip","durationMs":1234}
"""
let decoded = try JSONDecoder().decode(Request.self, from: Data(json.utf8))
switch decoded {
case let .cameraClip(_, durationMs, includeAudio, _):
#expect(durationMs == 1234)
#expect(includeAudio == true)
default:
Issue.record("expected cameraClip, got \(decoded)")
}
}
}