add support for multiple source states in transitions
Some checks failed
Lint / golangci-lint (push) Has been cancelled
Machine Tests / test (push) Has been cancelled

This commit is contained in:
Matthew Rich 2024-05-20 12:31:17 -07:00
parent e533a67303
commit 1835255b6d

View File

@ -61,3 +61,14 @@ func TestTransitionSubscribe(t *testing.T) {
t.Errorf("Invalid enter event")
}
}
func TestTransitionMultipleSourceStates(t *testing.T) {
tr := NewTransition("open", States("closed", "disconnected"), "opened")
assert.NotNil(t, tr)
mc := setupModel("closed")
assert.Nil(t, tr.Run(mc))
assert.Equal(t, "opened", string(mc.InspectState()))
md := setupModel("disconnected")
assert.Nil(t, tr.Run(md))
assert.Equal(t, "opened", string(md.InspectState()))
}