-
Notifications
You must be signed in to change notification settings - Fork 108
Expand file tree
/
Copy pathdeprecated_features_test.go
More file actions
25 lines (23 loc) · 989 Bytes
/
deprecated_features_test.go
File metadata and controls
25 lines (23 loc) · 989 Bytes
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
package rabbithole
import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("Deprecated feature flags", func() {
testFunc := func(b []byte, expectedPhase DeprecationPhase, wantErr bool) {
var d DeprecationPhase
if wantErr {
Ω(d.UnmarshalJSON(b)).To(MatchError(ContainSubstring("unknown deprecation phase:")))
return
}
Ω(d.UnmarshalJSON(b)).To(Succeed())
Ω(d).To(Equal(expectedPhase))
}
DescribeTable("deprecation phase unmarshal and mapping", testFunc,
Entry("Parsing permitted by default", []byte(`"permitted_by_default"`), DeprecationPermittedByDefault, false),
Entry("Parsing denied by default", []byte(`"denied_by_default"`), DeprecationDeniedByDefault, false),
Entry("Parsing disconnect", []byte(`"disconnect"`), DeprecationDisconnected, false),
Entry("Parsing removed", []byte(`"removed"`), DeprecationRemoved, false),
Entry("Parsing an invalid state", []byte(`"none-of-the-above"`), DeprecationPhase(-1), true),
)
})