Download this file
| 1 | package moves |
| 2 | |
| 3 | import "testing" |
| 4 | |
| 5 | func TestSwitchIsOffByDefault(t *testing.T) { |
| 6 | if DefaultEnabled { |
| 7 | t.Fatal("the Phase 1 switch must default to off until the copy record is approved") |
| 8 | } |
| 9 | env := map[string]string{} |
| 10 | get := func(k string) string { return env[k] } |
| 11 | if Enabled(get) { |
| 12 | t.Fatal("unset is off") |
| 13 | } |
| 14 | for _, v := range []string{"on", "1", "true"} { |
| 15 | env[SwitchEnv] = v |
| 16 | if !Enabled(get) { |
| 17 | t.Fatalf("%q should enable", v) |
| 18 | } |
| 19 | } |
| 20 | for _, v := range []string{"off", "0", "false", "yes", " on"} { |
| 21 | env[SwitchEnv] = v |
| 22 | if Enabled(get) { |
| 23 | t.Fatalf("%q should not enable", v) |
| 24 | } |
| 25 | } |
| 26 | } |
| 27 | |