From 1835255b6d0200c4f8700e48d79dd67787ad3097 Mon Sep 17 00:00:00 2001 From: Matthew Rich Date: Mon, 20 May 2024 12:31:17 -0700 Subject: [PATCH] add support for multiple source states in transitions --- transition_test.go | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/transition_test.go b/transition_test.go index 5a780ff..f7d0fe2 100644 --- a/transition_test.go +++ b/transition_test.go @@ -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())) +}