1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
package task
import "testing"
func TestValidStoryTransition_Valid(t *testing.T) {
cases := []struct {
from StoryState
to StoryState
}{
{StoryPending, StoryInProgress},
{StoryInProgress, StoryShippable},
{StoryInProgress, StoryNeedsFix},
{StoryNeedsFix, StoryInProgress},
{StoryShippable, StoryDeployed},
{StoryDeployed, StoryValidating},
{StoryValidating, StoryReviewReady},
{StoryValidating, StoryNeedsFix},
}
for _, tc := range cases {
if !ValidStoryTransition(tc.from, tc.to) {
t.Errorf("expected valid transition %s → %s", tc.from, tc.to)
}
}
}
func TestValidStoryTransition_Invalid(t *testing.T) {
cases := []struct {
from StoryState
to StoryState
}{
{StoryPending, StoryDeployed},
{StoryReviewReady, StoryPending},
{StoryReviewReady, StoryInProgress},
{StoryReviewReady, StoryShippable},
{StoryShippable, StoryPending},
}
for _, tc := range cases {
if ValidStoryTransition(tc.from, tc.to) {
t.Errorf("expected invalid transition %s → %s", tc.from, tc.to)
}
}
}
|