Add error handling tests for USB connection and listing ports

This commit is contained in:
just-stuff-tm committed 2026-03-05 02:26:37 -05:00
1 parent 524558c511
commit 25fc9454a8
3 files changed
+97 -1

No files matched your search

+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',
() {