Skip to content

Commit 8151c14

Browse files
committed
fix: use synthetic test data and correct assertions in MicrophoneServiceTests
1 parent 90393c5 commit 8151c14

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

OpenSuperMLXTests/MicrophoneServiceTests.swift

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,16 @@ final class MicrophoneServiceBluetoothTests: XCTestCase {
113113
XCTAssertTrue(MicrophoneService.shared.isBluetoothMicrophone(device))
114114
}
115115

116-
func testBluetoothDetection_MACAddress() {
116+
func testBluetoothDetection_MACAddressAloneIsInsufficient() {
117117
let device = MicrophoneService.AudioDevice(
118-
id: "00-22-BB-71-21-0A:input",
119-
name: "Amiron wireless",
120-
manufacturer: "Apple",
118+
id: "AA-BB-CC-DD-EE-FF:input",
119+
name: "Wireless Headset",
120+
manufacturer: "Acme",
121121
isBuiltIn: false
122122
)
123-
XCTAssertTrue(MicrophoneService.shared.isBluetoothMicrophone(device))
123+
// MAC address format triggers CoreAudio transport type check;
124+
// fake device has no CoreAudio entry, so detection returns false
125+
XCTAssertFalse(MicrophoneService.shared.isBluetoothMicrophone(device))
124126
}
125127

126128
func testBluetoothDetection_NotBluetooth() {
@@ -140,23 +142,23 @@ final class MicrophoneServiceRequiresConnectionTests: XCTestCase {
140142

141143
func testRequiresConnection_iPhone() {
142144
let device = MicrophoneService.AudioDevice(
143-
id: "B95EA61C-AC67-43B3-8AB4-8AE800000003",
144-
name: "Микрофон (iPhone nagibator)",
145+
id: "DEADBEEF-1234-5678-ABCD-000000000001",
146+
name: "iPhone Microphone",
145147
manufacturer: "Apple Inc.",
146148
isBuiltIn: false
147149
)
148150
XCTAssertTrue(MicrophoneService.shared.isContinuityMicrophone(device))
149151
XCTAssertTrue(MicrophoneService.shared.isBluetoothMicrophone(device) || MicrophoneService.shared.isContinuityMicrophone(device))
150152
}
151153

152-
func testRequiresConnection_Bluetooth() {
154+
func testRequiresConnection_MACAddressWithoutCoreAudio() {
153155
let device = MicrophoneService.AudioDevice(
154-
id: "00-22-BB-71-21-0A:input",
155-
name: "Amiron wireless",
156-
manufacturer: "Apple",
156+
id: "AA-BB-CC-DD-EE-FF:input",
157+
name: "Wireless Headset",
158+
manufacturer: "Acme",
157159
isBuiltIn: false
158160
)
159-
XCTAssertTrue(MicrophoneService.shared.isBluetoothMicrophone(device))
161+
XCTAssertFalse(MicrophoneService.shared.isBluetoothMicrophone(device))
160162
}
161163

162164
func testRequiresConnection_BuiltIn() {

0 commit comments

Comments
 (0)