-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathenrichment_test.go
More file actions
57 lines (52 loc) · 1.66 KB
/
enrichment_test.go
File metadata and controls
57 lines (52 loc) · 1.66 KB
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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package core
import "testing"
func TestDispatchStatus_IsValid(t *testing.T) {
cases := map[DispatchStatus]bool{
"": true, // empty = unset, normalised to ready
DispatchReady: true,
DispatchAwaitingDesign: true,
DispatchAwaitingVendor: true,
DispatchAwaitingReview: true,
DispatchNotNow: true,
"bogus": false,
"awaiting-something-else": false,
"READY": false, // case-sensitive on purpose
}
for in, want := range cases {
if got := in.IsValid(); got != want {
t.Errorf("DispatchStatus(%q).IsValid() = %v, want %v", in, got, want)
}
}
}
func TestDispatchStatus_EffectiveDefaultsToReady(t *testing.T) {
if got := DispatchStatus("").Effective(); got != DispatchReady {
t.Errorf("empty.Effective() = %q, want %q", got, DispatchReady)
}
if got := DispatchAwaitingVendor.Effective(); got != DispatchAwaitingVendor {
t.Errorf("vendor.Effective() = %q, want unchanged", got)
}
}
func TestEstimatedSize_IsValid(t *testing.T) {
cases := map[EstimatedSize]bool{
"": true,
SizeSmall: true,
SizeMedium: true,
SizeLarge: true,
"enormous": false,
"SMALL": false,
"medium-big": false,
}
for in, want := range cases {
if got := in.IsValid(); got != want {
t.Errorf("EstimatedSize(%q).IsValid() = %v, want %v", in, got, want)
}
}
}
func TestEstimatedSize_EffectiveDefaultsToMedium(t *testing.T) {
if got := EstimatedSize("").Effective(); got != SizeMedium {
t.Errorf("empty.Effective() = %q, want %q", got, SizeMedium)
}
if got := SizeSmall.Effective(); got != SizeSmall {
t.Errorf("small.Effective() = %q, want unchanged", got)
}
}