feat: complete Task 7 - end-to-end integration and full test suite
This commit is contained in:
@@ -17,9 +17,9 @@ func newMockMonitor(id string, tripCount int, scheduleFunc func(context.Context,
|
||||
yc := yandex.NewClient("test-key")
|
||||
|
||||
monitor := &StationMonitor{
|
||||
ID: id,
|
||||
Yandex: yc,
|
||||
Cache: cache.NewCacheStore(rc),
|
||||
ID: id,
|
||||
Yandex: yc,
|
||||
Cache: cache.NewCacheStore(rc),
|
||||
ScheduleFunc: scheduleFunc,
|
||||
}
|
||||
|
||||
@@ -204,13 +204,13 @@ func TestProcessStation_Reactivation_AfterClosure(t *testing.T) {
|
||||
_ = rc.Set(ctx, "station:zero_days:"+testMonitorID, "3", 24*time.Hour)
|
||||
_ = rc.Set(ctx, "station:status:"+testMonitorID, string(StatusClosed), 24*time.Hour)
|
||||
|
||||
// Day 4: trips resume - should reactivate
|
||||
// Day 4: trips resume - should reactivate
|
||||
err := ProcessStation(ctx, monitor)
|
||||
if err != nil {
|
||||
t.Fatalf("unexpected error on reactivation: %v", err)
|
||||
}
|
||||
|
||||
// Status should be active again
|
||||
// Status should be active again
|
||||
statusData, err := monitor.Cache.Get(ctx, stationStatusKey(testMonitorID))
|
||||
if err != nil {
|
||||
t.Fatalf("cache get error: %v", err)
|
||||
@@ -219,7 +219,7 @@ func TestProcessStation_Reactivation_AfterClosure(t *testing.T) {
|
||||
t.Errorf("expected status active after reactivation, got %s", string(statusData))
|
||||
}
|
||||
|
||||
// Zero days should be reset to 0
|
||||
// Zero days should be reset to 0
|
||||
zeroDaysData, err := monitor.Cache.Get(ctx, zeroDaysKey(testMonitorID))
|
||||
if err != nil {
|
||||
t.Fatalf("cache get zero days error: %v", err)
|
||||
@@ -232,4 +232,4 @@ func TestProcessStation_Reactivation_AfterClosure(t *testing.T) {
|
||||
if zeroDays != 0 {
|
||||
t.Errorf("expected zero days 0 after reactivation, got %d", zeroDays)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user