File size: 1,010 Bytes
fc93158
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import Foundation
import Testing
@testable import OpenClaw

struct AudioInputDeviceObserverTests {
    @Test func `has usable default input device returns bool`() {
        // Smoke test: verifies the composition logic runs without crashing.
        // Actual result depends on whether the host has an audio input device.
        let result = AudioInputDeviceObserver.hasUsableDefaultInputDevice()
        _ = result // suppress unused-variable warning; the assertion is "no crash"
    }

    @Test func `has usable default input device consistent with components`() {
        // When no default UID exists, the method must return false.
        // When a default UID exists, the result must match alive-set membership.
        let uid = AudioInputDeviceObserver.defaultInputDeviceUID()
        let alive = AudioInputDeviceObserver.aliveInputDeviceUIDs()
        let expected = uid.map { alive.contains($0) } ?? false
        #expect(AudioInputDeviceObserver.hasUsableDefaultInputDevice() == expected)
    }
}