36 lines
873 B
Go
36 lines
873 B
Go
package app
|
|
|
|
import "testing"
|
|
|
|
func TestValidClock(t *testing.T) {
|
|
tests := map[string]bool{
|
|
"": true,
|
|
"00:00": true,
|
|
"09:30": true,
|
|
"23:59": true,
|
|
"24:00": false,
|
|
"12:60": false,
|
|
"9:30": false,
|
|
"noon": false,
|
|
}
|
|
for value, expected := range tests {
|
|
if actual := validClock(value); actual != expected {
|
|
t.Fatalf("validClock(%q) = %v, want %v", value, actual, expected)
|
|
}
|
|
}
|
|
}
|
|
|
|
func TestOrderEntitlementActive(t *testing.T) {
|
|
active := []string{"PAID", "REFUND_REQUESTED", "REFUNDING"}
|
|
for _, status := range active {
|
|
if !orderEntitlementActive(status) {
|
|
t.Fatalf("status %s must keep the membership entitlement active", status)
|
|
}
|
|
}
|
|
for _, status := range []string{"CREATED", "REFUNDED", "CLOSED", "UNKNOWN"} {
|
|
if orderEntitlementActive(status) {
|
|
t.Fatalf("status %s must not grant a membership entitlement", status)
|
|
}
|
|
}
|
|
}
|