24 lines
835 B
Go
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)
|
|
}
|
|
}
|