M1: broadcast focus updates, expiry uses Expire outcome
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"testing"
|
||||
|
||||
"antidrift/internal/domain"
|
||||
"antidrift/internal/evidence"
|
||||
"antidrift/internal/session"
|
||||
|
||||
"github.com/gin-gonic/gin"
|
||||
@@ -69,3 +70,31 @@ func TestIllegalTransitionReturns409(t *testing.T) {
|
||||
t.Fatalf("expected 409, got %d", w.Code)
|
||||
}
|
||||
}
|
||||
|
||||
func TestActiveStatePayloadCarriesEvidence(t *testing.T) {
|
||||
s := newTestServer(t)
|
||||
r := s.Router()
|
||||
_ = post(t, r, "/planning", "")
|
||||
body := `{"next_action":"Build web","success_condition":"web tests pass","timebox_secs":1500}`
|
||||
if w := post(t, r, "/commitment", body); w.Code != http.StatusOK {
|
||||
t.Fatalf("/commitment code %d body %s", w.Code, w.Body.String())
|
||||
}
|
||||
// A focus update should appear in the serialized state.
|
||||
s.ctrl.RecordWindow(evidence.WindowSnapshot{Class: "code", Title: "antidrift", Health: evidence.EvidenceHealth{Available: true}})
|
||||
|
||||
js := s.stateJSON()
|
||||
if !strings.Contains(js, `"evidence"`) {
|
||||
t.Fatalf("payload missing evidence object: %s", js)
|
||||
}
|
||||
if !strings.Contains(js, `"class":"code"`) {
|
||||
t.Fatalf("payload missing current window: %s", js)
|
||||
}
|
||||
}
|
||||
|
||||
func TestLockedStateHasNullEvidence(t *testing.T) {
|
||||
s := newTestServer(t)
|
||||
js := s.stateJSON()
|
||||
if !strings.Contains(js, `"evidence":null`) {
|
||||
t.Fatalf("locked payload should have null evidence: %s", js)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user