-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy pathevents_test.go
57 lines (46 loc) · 1.33 KB
/
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
package main_test
import (
. "banku"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
)
var _ = Describe("Event", func() {
var (
accId = "AB928323-2837232832-3283232-232"
amount = 2000
)
Describe("NewCreateAccountEvent", func() {
It("can create a create account event", func() {
name := "John Smith"
event := NewCreateAccountEvent(name)
Expect(event.AccName).To(Equal(name))
Expect(event.AccId).NotTo(BeNil())
Expect(event.Type).To(Equal("CreateEvent"))
})
})
Describe("NewDepositEvent", func() {
It("can create a deposit event", func() {
event := NewDepositEvent(accId, amount)
Expect(event.AccId).To(Equal(accId))
Expect(event.Amount).To(Equal(amount))
Expect(event.Type).To(Equal("DepositEvent"))
})
})
Describe("NewWithdrawEvent", func() {
It("can create a withdrawal event", func() {
event := NewWithdrawEvent(accId, amount)
Expect(event.AccId).To(Equal(accId))
Expect(event.Amount).To(Equal(amount))
Expect(event.Type).To(Equal("WithdrawEvent"))
})
})
Describe("NewTransferEvent", func() {
It("can create a transfer event", func() {
event := NewTransferEvent(accId, "T0", amount)
Expect(event.AccId).To(Equal(accId))
Expect(event.Amount).To(Equal(amount))
Expect(event.TargetId).To(Equal("T0"))
Expect(event.Type).To(Equal("TransferEvent"))
})
})
})