mirror of
https://github.com/hanzoai/bot.git
synced 2026-10-30 17:24:26 +00:00
Squash merge of 1,462 upstream commits with openclaw→hanzo-bot naming transforms applied. Conflicts resolved favoring our main branch to preserve existing customizations. Key upstream additions: - iOS Security Stack (concurrency locks, runtime guards, TTS fallback) - Discord CDN hostname allowlisting for SSRF protection - Discord mention handling improvements - Various bug fixes and stability improvements
47 lines
1.5 KiB
Swift
47 lines
1.5 KiB
Swift
import Foundation
|
|
import Testing
|
|
@testable import HanzoBot
|
|
|
|
@Suite(.serialized)
|
|
struct NixModeStableSuiteTests {
|
|
@Test func resolvesFromStableSuiteForAppBundles() {
|
|
let suite = UserDefaults(suiteName: launchdLabel)!
|
|
let key = "bot.nixMode"
|
|
let prev = suite.object(forKey: key)
|
|
defer {
|
|
if let prev { suite.set(prev, forKey: key) } else { suite.removeObject(forKey: key) }
|
|
}
|
|
|
|
suite.set(true, forKey: key)
|
|
|
|
let standard = try #require(UserDefaults(suiteName: "NixModeStableSuiteTests.\(UUID().uuidString)"))
|
|
#expect(!standard.bool(forKey: key))
|
|
|
|
let resolved = ProcessInfo.resolveNixMode(
|
|
environment: [:],
|
|
standard: standard,
|
|
stableSuite: suite,
|
|
isAppBundle: true)
|
|
#expect(resolved)
|
|
}
|
|
|
|
@Test func ignoresStableSuiteOutsideAppBundles() {
|
|
let suite = UserDefaults(suiteName: launchdLabel)!
|
|
let key = "bot.nixMode"
|
|
let prev = suite.object(forKey: key)
|
|
defer {
|
|
if let prev { suite.set(prev, forKey: key) } else { suite.removeObject(forKey: key) }
|
|
}
|
|
|
|
suite.set(true, forKey: key)
|
|
let standard = try #require(UserDefaults(suiteName: "NixModeStableSuiteTests.\(UUID().uuidString)"))
|
|
|
|
let resolved = ProcessInfo.resolveNixMode(
|
|
environment: [:],
|
|
standard: standard,
|
|
stableSuite: suite,
|
|
isAppBundle: false)
|
|
#expect(!resolved)
|
|
}
|
|
}
|