Skip to content

Commit 753360b

Browse files
author
Ciro S. Costa
committed
Finishes validation tests
1 parent 6d03a9a commit 753360b

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

cast/cast_test.go

+43
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ var (
1414
Width: 123,
1515
Height: 123,
1616
}
17+
invalidHeader = cast.Header{
18+
Version: 123,
19+
}
1720
validEvent1 = cast.Event{
1821
Time: 1,
1922
Type: "o",
@@ -47,6 +50,46 @@ var _ = Describe("Cast", func() {
4750
})
4851
})
4952

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+
5093
})
5194

5295
Describe("ValidateEvent", func() {

0 commit comments

Comments
 (0)