Add error handling tests for USB connection and listing ports

This commit is contained in:
just-stuff-tm
2026-03-04 14:17:01 -05:00
parent 524558c511
commit 25fc9454a8
3 changed files with 97 additions and 1 deletions
+18
View File
@@ -35,6 +35,24 @@ void main() {
},
);
test('friendlyUsbPortName works for Linux-style label', () {
expect(
friendlyUsbPortName(
'/dev/ttyACM0 - RAK4631 - USB VID:PID=239A:8029 SER=xxxxxxxx',
),
'RAK4631',
);
});
test('friendlyUsbPortName trims whitespace from label parts', () {
expect(
friendlyUsbPortName(
' /dev/ttyS0 - My Serial Port - n/a ',
),
'My Serial Port',
);
});
test(
'friendlyUsbPortName falls back to port name when description is n/a',
() {