diff options
Diffstat (limited to 'internal/task/task_test.go')
| -rw-r--r-- | internal/task/task_test.go | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/internal/task/task_test.go b/internal/task/task_test.go index a8e0a84..6498271 100644 --- a/internal/task/task_test.go +++ b/internal/task/task_test.go @@ -45,6 +45,7 @@ func TestValidTransition_DisallowedTransitions(t *testing.T) { {"completed to queued", StateCompleted, StateQueued}, {"failed to completed", StateFailed, StateCompleted}, {"timed out to completed", StateTimedOut, StateCompleted}, + {"ready to queued", StateReady, StateQueued}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { @@ -55,6 +56,19 @@ func TestValidTransition_DisallowedTransitions(t *testing.T) { } } +func TestValidTransition_ReadyState(t *testing.T) { + valid := []struct{ from, to State }{ + {StateRunning, StateReady}, + {StateReady, StateCompleted}, + {StateReady, StatePending}, + } + for _, tt := range valid { + if !ValidTransition(tt.from, tt.to) { + t.Errorf("expected transition %s -> %s to be valid", tt.from, tt.to) + } + } +} + func TestDuration_UnmarshalYAML(t *testing.T) { var d Duration unmarshal := func(v interface{}) error { |
