From 0dddd8ca0911c29195ee861793c61782b9e52bd0 Mon Sep 17 00:00:00 2001 From: Tai Groot Date: Tue, 2 Aug 2022 20:16:09 -0700 Subject: [PATCH] add more unit tests to parseDevices --- adb_test.go | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/adb_test.go b/adb_test.go index cfdca2b..5779e42 100644 --- a/adb_test.go +++ b/adb_test.go @@ -15,6 +15,27 @@ func Test_parseDevices(t *testing.T) { want []Device wantErr bool }{ + { + name: "no devices", args: args{stdout: `List of devices attached`}, + wantErr: false, + want: []Device{}, + }, + { + name: "1 auth dev", args: args{stdout: `List of devices attached +19291FDEE0023W device`}, + wantErr: false, + want: []Device{ + {IsAuthorized: true, SerialNo: "19291FDEE0023W"}, + }, + }, + { + name: "1 unauth dev", args: args{stdout: `List of devices attached +HT75R0202681 unauthorized`}, + wantErr: false, + want: []Device{ + {IsAuthorized: false, SerialNo: "HT75R0202681"}, + }, + }, { name: "2 auth 1 unauth", args: args{stdout: `List of devices attached 19291FDEE0023W device