11import { describe , expect , it , vi } from "vitest" ;
2+ import { status } from "./ops.js" ;
23import { createCronServiceState } from "./state.js" ;
34
45describe ( "cron service state seam coverage" , ( ) => {
@@ -18,6 +19,7 @@ describe("cron service state seam coverage", () => {
1819 error : vi . fn ( ) ,
1920 } ,
2021 storePath : "/tmp/cron/jobs.json" ,
22+ statusStorePath : "/tmp/state/openclaw.sqlite" ,
2123 cronEnabled : true ,
2224 defaultAgentId : "ops" ,
2325 sessionStorePath : "/tmp/sessions.json" ,
@@ -36,6 +38,7 @@ describe("cron service state seam coverage", () => {
3638 expect ( state . storeFileMtimeMs ) . toBeNull ( ) ;
3739
3840 expect ( state . deps . storePath ) . toBe ( "/tmp/cron/jobs.json" ) ;
41+ expect ( state . deps . statusStorePath ) . toBe ( "/tmp/state/openclaw.sqlite" ) ;
3942 expect ( state . deps . cronEnabled ) . toBe ( true ) ;
4043 expect ( state . deps . defaultAgentId ) . toBe ( "ops" ) ;
4144 expect ( state . deps . sessionStorePath ) . toBe ( "/tmp/sessions.json" ) ;
@@ -67,4 +70,24 @@ describe("cron service state seam coverage", () => {
6770
6871 nowSpy . mockRestore ( ) ;
6972 } ) ;
73+
74+ it ( "reports statusStorePath instead of the internal cron mirror path" , async ( ) => {
75+ const state = createCronServiceState ( {
76+ log : {
77+ debug : vi . fn ( ) ,
78+ info : vi . fn ( ) ,
79+ warn : vi . fn ( ) ,
80+ error : vi . fn ( ) ,
81+ } ,
82+ storePath : "/tmp/cron/jobs.json" ,
83+ statusStorePath : "/tmp/state/openclaw.sqlite" ,
84+ cronEnabled : true ,
85+ enqueueSystemEvent : vi . fn ( ) ,
86+ requestHeartbeat : vi . fn ( ) ,
87+ runIsolatedAgentJob : vi . fn ( async ( ) => ( { status : "ok" as const } ) ) ,
88+ } ) ;
89+
90+ const summary = await status ( state ) ;
91+ expect ( summary . storePath ) . toBe ( "/tmp/state/openclaw.sqlite" ) ;
92+ } ) ;
7093} ) ;
0 commit comments