-
Notifications
You must be signed in to change notification settings - Fork 3
/
events_test.go
43 lines (32 loc) · 934 Bytes
/
events_test.go
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
package raft_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
. "github.com/bbengfort/raft"
)
//===========================================================================
// Mock Test Event
//===========================================================================
type testEvent struct {
idx int
jdx int
}
func (e *testEvent) Type() EventType {
return EventType(99)
}
func (e *testEvent) Source() interface{} {
return e.idx
}
func (e *testEvent) Value() interface{} {
return e.jdx
}
var _ = Describe("Events", func() {
It("should be able to assign mock event to EventType", func() {
var event Event = &testEvent{} // this will fail before the assertion but is a good sanity check
Ω(&testEvent{}).Should(BeAssignableToTypeOf(event))
})
It("should return unnknown as event type string repr", func() {
event := &testEvent{}
Ω(event.Type().String()).Should(Equal("unknown"))
})
})