File tree 1 file changed +43
-0
lines changed
1 file changed +43
-0
lines changed Original file line number Diff line number Diff line change 14
14
Width : 123 ,
15
15
Height : 123 ,
16
16
}
17
+ invalidHeader = cast.Header {
18
+ Version : 123 ,
19
+ }
17
20
validEvent1 = cast.Event {
18
21
Time : 1 ,
19
22
Type : "o" ,
@@ -47,6 +50,46 @@ var _ = Describe("Cast", func() {
47
50
})
48
51
})
49
52
53
+ Context ("w/ cast containing invalid header" , func () {
54
+ It ("fails" , func () {
55
+ isValid , err := cast .Validate (& cast.Cast {
56
+ Header : invalidHeader ,
57
+ })
58
+
59
+ Expect (err ).NotTo (Succeed ())
60
+ Expect (isValid ).NotTo (BeTrue ())
61
+ })
62
+ })
63
+
64
+ Context ("w/ cast containing invalid event stream" , func () {
65
+ It ("fails" , func () {
66
+ isValid , err := cast .Validate (& cast.Cast {
67
+ Header : validHeader ,
68
+ EventStream : []* cast.Event {
69
+ & invalidEvent4 ,
70
+ },
71
+ })
72
+
73
+ Expect (err ).NotTo (Succeed ())
74
+ Expect (isValid ).NotTo (BeTrue ())
75
+ })
76
+ })
77
+
78
+ Context ("w/ wellformed cast" , func () {
79
+ It ("succeeds" , func () {
80
+ isValid , err := cast .Validate (& cast.Cast {
81
+ Header : validHeader ,
82
+ EventStream : []* cast.Event {
83
+ & validEvent1 ,
84
+ & validEvent2 ,
85
+ },
86
+ })
87
+
88
+ Expect (err ).To (Succeed ())
89
+ Expect (isValid ).To (BeTrue ())
90
+ })
91
+ })
92
+
50
93
})
51
94
52
95
Describe ("ValidateEvent" , func () {
You can’t perform that action at this time.
0 commit comments