@@ -38,6 +38,21 @@ describe("gittensory-miner laptop mode bootstrap (#2329)", () => {
3838 expect ( resolveLaptopModeStateDbPath ( { } ) ) . toMatch ( / \/ \. c o n f i g \/ g i t t e n s o r y - m i n e r \/ r u n - s t a t e \. s q l i t e 3 $ / ) ;
3939 } ) ;
4040
41+ it ( "keeps the laptop-mode config dir on the config chain even when the run-state DB path is overridden" , ( ) => {
42+ const env = {
43+ GITTENSORY_MINER_RUN_STATE_DB : "/custom/state.sqlite3" ,
44+ GITTENSORY_MINER_CONFIG_DIR : "/custom/config" ,
45+ XDG_CONFIG_HOME : "/xdg" ,
46+ } ;
47+
48+ expect ( resolveLaptopModeConfigDir ( env ) ) . toBe ( "/custom/config" ) ;
49+ expect ( resolveLaptopModeStateDbPath ( env ) ) . toBe ( "/custom/state.sqlite3" ) ;
50+ expect ( resolveLaptopModeConfigDir ( {
51+ GITTENSORY_MINER_RUN_STATE_DB : "/custom/state.sqlite3" ,
52+ XDG_CONFIG_HOME : "/xdg" ,
53+ } ) ) . toBe ( "/xdg/gittensory-miner" ) ;
54+ } ) ;
55+
4156 it ( "initializes the config dir and SQLite run-state store on a fresh laptop-mode boot" , ( ) => {
4257 const configDir = join ( tempRoot ( ) , "config" ) ;
4358 const result = initLaptopMode ( { env : { GITTENSORY_MINER_CONFIG_DIR : configDir } } ) ;
@@ -111,9 +126,8 @@ describe("gittensory-miner laptop mode bootstrap (#2329)", () => {
111126 expect ( formatLaptopDoctor ( report ) ) . toContain ( "miner_run_state ready" ) ;
112127 } ) ;
113128
114- it ( "doctor handles missing Docker and a missing state DB gracefully" , ( ) => {
129+ it ( "doctor treats a fresh, creatable config dir as writable and handles missing Docker gracefully" , ( ) => {
115130 const configDir = join ( tempRoot ( ) , "config" ) ;
116- mkdirSync ( configDir , { recursive : true } ) ;
117131
118132 const report = inspectLaptopMode ( {
119133 env : { GITTENSORY_MINER_CONFIG_DIR : configDir } ,
@@ -125,10 +139,16 @@ describe("gittensory-miner laptop mode bootstrap (#2329)", () => {
125139 } ) ) as never ,
126140 } ) ;
127141
142+ expect ( report . configDir ) . toMatchObject ( {
143+ path : configDir ,
144+ exists : false ,
145+ writable : true ,
146+ error : null ,
147+ } ) ;
128148 expect ( report . stateDb ) . toMatchObject ( {
129149 path : join ( configDir , "run-state.sqlite3" ) ,
130150 exists : false ,
131- writable : false ,
151+ writable : true ,
132152 sqliteReady : false ,
133153 schemaReady : false ,
134154 schemaError : null ,
@@ -137,6 +157,25 @@ describe("gittensory-miner laptop mode bootstrap (#2329)", () => {
137157 expect ( formatLaptopDoctor ( report ) ) . toContain ( "Docker: unavailable (docker not found on PATH; informational only)" ) ;
138158 } ) ;
139159
160+ it ( "doctor treats a timed-out Docker probe as informational only" , ( ) => {
161+ const configDir = join ( tempRoot ( ) , "config" ) ;
162+ initLaptopMode ( { env : { GITTENSORY_MINER_CONFIG_DIR : configDir } } ) ;
163+
164+ const report = inspectLaptopMode ( {
165+ env : { GITTENSORY_MINER_CONFIG_DIR : configDir } ,
166+ spawnSyncFn : vi . fn ( ( ) => ( {
167+ status : null ,
168+ stdout : "" ,
169+ stderr : "" ,
170+ error : Object . assign ( new Error ( "spawn docker ETIMEDOUT" ) , { code : "ETIMEDOUT" } ) ,
171+ } ) ) as never ,
172+ } ) ;
173+
174+ expect ( report . docker . available ) . toBe ( false ) ;
175+ expect ( report . docker . detail ) . toContain ( "timed out" ) ;
176+ expect ( formatLaptopDoctor ( report ) ) . toContain ( "informational only" ) ;
177+ } ) ;
178+
140179 it ( "doctor surfaces an invalid existing SQLite file with the schema error detail in the human output" , ( ) => {
141180 const configDir = join ( tempRoot ( ) , "config" ) ;
142181 mkdirSync ( configDir , { recursive : true } ) ;
0 commit comments