mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
Comprehensive rename of all openclaw references to hanzo-bot equivalents: - Package: openclaw → @hanzo/bot - Binary: openclaw → hanzo-bot - Types: OpenClaw* → Bot* - Env vars: OPENCLAW_* → BOT_* - Android: ai.openclaw.android → ai.hanzo.bot.android - iOS/macOS: ai.openclaw.* → ai.hanzo.* - Swift modules: OpenClaw* → Bot* - Plugins: openclaw.plugin.json → bot.plugin.json - Paths: .openclaw/ → .hanzo/bot/ - URLs: github.com/openclaw → github.com/hanzoai
57 lines
1.7 KiB
Swift
57 lines
1.7 KiB
Swift
import Testing
|
|
@testable import HanzoBot
|
|
|
|
@Suite
|
|
@MainActor
|
|
struct ExecApprovalsGatewayPrompterTests {
|
|
@Test func sessionMatchPrefersActiveSession() {
|
|
let matches = ExecApprovalsGatewayPrompter._testShouldPresent(
|
|
mode: .remote,
|
|
activeSession: " main ",
|
|
requestSession: "main",
|
|
lastInputSeconds: nil)
|
|
#expect(matches)
|
|
|
|
let mismatched = ExecApprovalsGatewayPrompter._testShouldPresent(
|
|
mode: .remote,
|
|
activeSession: "other",
|
|
requestSession: "main",
|
|
lastInputSeconds: 0)
|
|
#expect(!mismatched)
|
|
}
|
|
|
|
@Test func sessionFallbackUsesRecentActivity() {
|
|
let recent = ExecApprovalsGatewayPrompter._testShouldPresent(
|
|
mode: .remote,
|
|
activeSession: nil,
|
|
requestSession: "main",
|
|
lastInputSeconds: 10,
|
|
thresholdSeconds: 120)
|
|
#expect(recent)
|
|
|
|
let stale = ExecApprovalsGatewayPrompter._testShouldPresent(
|
|
mode: .remote,
|
|
activeSession: nil,
|
|
requestSession: "main",
|
|
lastInputSeconds: 200,
|
|
thresholdSeconds: 120)
|
|
#expect(!stale)
|
|
}
|
|
|
|
@Test func defaultBehaviorMatchesMode() {
|
|
let local = ExecApprovalsGatewayPrompter._testShouldPresent(
|
|
mode: .local,
|
|
activeSession: nil,
|
|
requestSession: nil,
|
|
lastInputSeconds: 400)
|
|
#expect(local)
|
|
|
|
let remote = ExecApprovalsGatewayPrompter._testShouldPresent(
|
|
mode: .remote,
|
|
activeSession: nil,
|
|
requestSession: nil,
|
|
lastInputSeconds: 400)
|
|
#expect(!remote)
|
|
}
|
|
}
|