Files
Assistant/tests/topology_equivalence/commit_test.go
2026-08-16 15:22:49 +03:00

24 lines
835 B
Go

package topology_equivalence_test
import (
"encoding/json"
commitcontract "git.cin.su/m/Assistant/contracts/commit"
"git.cin.su/m/Assistant/platform/ids"
"testing"
)
func TestWS004UnknownOutcomeSurvivesSerialization(t *testing.T) {
attempt := commitcontract.ActionAttempt{ID: commitcontract.ActionAttemptID(ids.ID("attempt")), AuthorizedID: commitcontract.AuthorizedActionID(ids.ID("authorized")), IntentID: commitcontract.ActionIntentID(ids.ID("intent")), State: commitcontract.ActionUnknownOutcome}
raw, err := json.Marshal(attempt)
if err != nil {
t.Fatal(err)
}
var restored commitcontract.ActionAttempt
if err := json.Unmarshal(raw, &restored); err != nil {
t.Fatal(err)
}
if restored != attempt || restored.State != commitcontract.ActionUnknownOutcome {
t.Fatalf("semantic state changed: %#v", restored)
}
}