package store import ( "context" "testing" "time" ) // TestDroppedDeliveryAttemptRoundTrips — Vikunja #370. A suppressed nudge is // recorded as 'dropped'. The status column has a CHECK constraint, so this // only works if migration #12 widened it; a fake outbox in a unit test would // not catch that. func TestDroppedDeliveryAttemptRoundTrips(t *testing.T) { s := newTestStore(t) ctx := context.Background() now := time.Now() id, err := s.BeginDeliveryAttempt(ctx, "nudge", "water", 0, "drop", "abc123", now) if err != nil { t.Fatalf("BeginDeliveryAttempt: %v", err) } if err := s.CompleteDeliveryAttempt(ctx, id, DeliveryDropped, now); err != nil { t.Fatalf("CompleteDeliveryAttempt: %v", err) } var status string err = s.db.QueryRowContext(ctx, `SELECT status FROM delivery_attempts WHERE id = ?`, id).Scan(&status) if err != nil { t.Fatalf("read back: %v", err) } if status != DeliveryDropped { t.Fatalf("status: want %q, got %q", DeliveryDropped, status) } }