@@ -344,12 +344,49 @@ test("getvar()", async t => {
344344} ) ;
345345
346346test ( "getDeviceName()" , async t => {
347- const [ [ fastboot_true ] , [ fastboot_error ] ] = fake ( ) (
347+ const [
348+ [ fastboot_true ] ,
349+ [ fastboot_tab_at_beginning ] ,
350+ [ fastboot_whitespaces_all_around ] ,
351+ [ fastboot_waiting ] ,
352+ [ fastboot_waiting_with_tab ] ,
353+ [ fastboot_waiting_with_whitespace ] ,
354+ [ fastboot_weird_output ] ,
355+ [ fastboot_error ]
356+ ] = fake ( ) (
348357 [ "" , "product: FP2\nFinished. Total time: 0.000s" , 0 ] ,
358+ [ "" , "\tproduct: sdm845\nFinished. Total time: 0.001s" , 0 ] ,
359+ [ "" , " product: lahaina \nFinished. Total time: 0.001s" , 0 ] ,
360+ [
361+ "" ,
362+ "< waiting for any device >\nproduct: axolotl\nFinished. Total time: 0.001s" ,
363+ 0
364+ ] ,
365+ [
366+ "" ,
367+ "< waiting for any device >\n\tproduct: otter \t \nFinished. Total time: 0.001s" ,
368+ 0
369+ ] ,
370+ [
371+ "" ,
372+ "< waiting for any device >\n product: FP5 \nFinished. Total time: 0.001s" ,
373+ 0
374+ ] ,
375+ [
376+ "" ,
377+ "\t\n\n \n< waiting for any device >\nThis\nis\npretty\nweird\output\n\n product: qcm6490 \nFinished. Total time: 0.001s" ,
378+ 0
379+ ] ,
349380 [ "error" , "" , 0 ]
350381 ) ;
351382 await Promise . all ( [
352383 t . is ( await fastboot_true . getDeviceName ( ) , "FP2" ) ,
384+ t . is ( await fastboot_tab_at_beginning . getDeviceName ( ) , "sdm845" ) ,
385+ t . is ( await fastboot_whitespaces_all_around . getDeviceName ( ) , "lahaina" ) ,
386+ t . is ( await fastboot_waiting . getDeviceName ( ) , "axolotl" ) ,
387+ t . is ( await fastboot_waiting_with_tab . getDeviceName ( ) , "otter" ) ,
388+ t . is ( await fastboot_waiting_with_whitespace . getDeviceName ( ) , "FP5" ) ,
389+ t . is ( await fastboot_weird_output . getDeviceName ( ) , "qcm6490" ) ,
353390 t . throwsAsync ( fastboot_error . getDeviceName ( ) , {
354391 message : 'Unexpected getvar return: "error"'
355392 } )
0 commit comments