package main import ( "testing" "git.toki-labs.com/toki/alt/services/worker/internal/jobs" "git.toki-labs.com/toki/alt/services/worker/internal/storage/postgres" ) // TestStoreBackedDepsWiresBacktestSurfaces guards against a regression where the // worker process serves backtest reads but leaves the start surface (Starter) // unwired, which would advertise no backtest-start capability and reject every // start command. The store is built with a nil pool because the wiring path only // constructs adapters; it never touches the database at startup. func TestStoreBackedDepsWiresBacktestSurfaces(t *testing.T) { runner := jobs.NewRunner() deps := storeBackedDeps(runner, postgres.NewStore(nil)) if deps.Starter == nil { t.Error("expected backtest Starter to be wired") } if deps.Analysis == nil || deps.Results == nil { t.Error("expected backtest read stores to be wired") } if deps.Instruments == nil || deps.Bars == nil { t.Error("expected market stores to be wired") } if deps.DailyBarImporter == nil { t.Error("expected daily bar importer to be wired") } if deps.Paper == nil { t.Error("expected paper trading service to be wired") } if deps.Live == nil { t.Error("expected live trading service to be wired (audit query surface must be up even without a broker)") } // Wiring registers the import and run-backtest job handlers on the runner, so // it must hold at least those two handlers after wiring. if runner.Len() < 2 { t.Errorf("expected wiring to register job handlers, runner holds %d", runner.Len()) } }