Make Complete atomic and guard zero deadline
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -85,3 +85,23 @@ func TestStateRestoresFromSnapshot(t *testing.T) {
|
||||
t.Fatalf("restored commitment missing: %+v", st.Commitment)
|
||||
}
|
||||
}
|
||||
|
||||
func TestRestoredCommitmentKeepsDeadline(t *testing.T) {
|
||||
path := filepath.Join(t.TempDir(), "state.json")
|
||||
first, err := New(path)
|
||||
if err != nil {
|
||||
t.Fatalf("new: %v", err)
|
||||
}
|
||||
_ = first.EnterPlanning()
|
||||
_ = first.StartManualCommitment("Keep deadline", "done", 25*time.Minute)
|
||||
want := first.State().Commitment.DeadlineUnixSecs
|
||||
|
||||
second, err := New(path)
|
||||
if err != nil {
|
||||
t.Fatalf("reopen: %v", err)
|
||||
}
|
||||
got := second.State().Commitment
|
||||
if got == nil || got.DeadlineUnixSecs != want {
|
||||
t.Fatalf("restored deadline: got %+v want %d", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user