refactor: introduce clock to make tests reproducible
This commit is contained in:
@@ -10,6 +10,7 @@ import (
|
||||
"time"
|
||||
|
||||
assets "github.com/wotra/wotra"
|
||||
"github.com/wotra/wotra/internal/clock"
|
||||
"github.com/wotra/wotra/internal/config"
|
||||
"github.com/wotra/wotra/internal/handler"
|
||||
"github.com/wotra/wotra/internal/service"
|
||||
@@ -46,10 +47,12 @@ func main() {
|
||||
settingsStore := store.NewSettingsStore(db)
|
||||
syncStore := store.NewSyncStore(db)
|
||||
|
||||
entrySvc := service.NewEntryService(entryStore, closedDayStore, settingsStore, syncStore, tz)
|
||||
daySvc := service.NewDayService(entryStore, closedDayStore, closedWeekStore, settingsStore, syncStore, tz)
|
||||
settingsSvc := service.NewSettingsService(settingsStore, syncStore)
|
||||
weekSvc := service.NewWeekService(closedDayStore, closedWeekStore, entryStore, settingsStore, adjustmentStore, syncStore, db, tz)
|
||||
clk := clock.Real()
|
||||
|
||||
entrySvc := service.NewEntryService(entryStore, closedDayStore, settingsStore, syncStore, tz, clk)
|
||||
daySvc := service.NewDayService(entryStore, closedDayStore, closedWeekStore, settingsStore, syncStore, tz, clk)
|
||||
settingsSvc := service.NewSettingsService(settingsStore, syncStore, clk)
|
||||
weekSvc := service.NewWeekService(closedDayStore, closedWeekStore, entryStore, settingsStore, adjustmentStore, syncStore, db, tz, clk)
|
||||
|
||||
// Background goroutine: auto-stop entries that cross midnight
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
|
||||
Reference in New Issue
Block a user