@@ -39,7 +39,15 @@ printf '%s\\n' "active"
3939 'findmnt' ,
4040 `#!/usr/bin/env bash
4141set -eu
42- printf '%s\\n' "/mnt/local/books/bookDisk"
42+ if [[ "\${1:-}" == "-rn" && "\${2:-}" == "-M" ]]; then
43+ printf '%s\\n' "/mnt/local/books/bookDisk"
44+ exit 0
45+ fi
46+ if [[ "\${1:-}" == "-rn" && "\${2:-}" == "-S" ]]; then
47+ printf '%s\\n' "/mnt/local/books/bookDisk"
48+ exit 0
49+ fi
50+ exit 0
4351` ,
4452 )
4553
@@ -50,4 +58,44 @@ printf '%s\\n' "/mnt/local/books/bookDisk"
5058 expect ( result . stdout ) . toContain ( 'mounted: yes' )
5159 expect ( result . stdout ) . toContain ( 'automount_state: active' )
5260 } )
61+
62+ it ( 'reports when a disk is mounted at a different target' , ( ) => {
63+ const workspace = createWorkspace ( )
64+ workspaces . push ( workspace )
65+
66+ ensureFakeDevice ( workspace , 'LABEL:local-book' )
67+ ensureFakeDevice ( workspace , 'UUID:local-debut' )
68+
69+ installMockCommand (
70+ workspace ,
71+ 'systemctl' ,
72+ `#!/usr/bin/env bash
73+ set -eu
74+ printf '%s\\n' "inactive"
75+ ` ,
76+ )
77+ installMockCommand (
78+ workspace ,
79+ 'findmnt' ,
80+ `#!/usr/bin/env bash
81+ set -eu
82+ if [[ "\${1:-}" == "-rn" && "\${2:-}" == "-M" ]]; then
83+ exit 1
84+ fi
85+ if [[ "\${1:-}" == "-rn" && "\${2:-}" == "-S" ]]; then
86+ printf '%s\\n' "/vol00/WDC WD40EZRZ-00GXCB0"
87+ exit 0
88+ fi
89+ exit 0
90+ ` ,
91+ )
92+
93+ const result = runSource ( workspace , [ 'status' ] )
94+
95+ expect ( result . exitCode ) . toBe ( 0 )
96+ expect ( result . stdout ) . toContain ( 'mounted: no' )
97+ expect ( result . stdout ) . toContain (
98+ 'mounted_elsewhere: /vol00/WDC WD40EZRZ-00GXCB0' ,
99+ )
100+ } )
53101} )
0 commit comments