-
Notifications
You must be signed in to change notification settings - Fork 8
/
notifier_test.go
43 lines (33 loc) · 979 Bytes
/
notifier_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 wfl_test
import (
"github.com/dgruber/wfl"
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"
)
var _ = Describe("Notifier", func() {
Context("happy path", func() {
It("should be possible to create and destroy a notifier", func() {
notifier := wfl.NewNotifier()
Ω(notifier).ShouldNot(BeNil())
notifier.Destroy()
})
It("should receive a job when a job is send", func() {
notifier := wfl.NewNotifier()
Ω(notifier).ShouldNot(BeNil())
defer notifier.Destroy()
notifier.SendJob(wfl.EmptyJob())
notifier.SendJob(wfl.EmptyJob())
notifier.ReceiveJob()
notifier.ReceiveJob()
})
It("should forward the job when Notify() is called", func() {
notifier := wfl.NewNotifier()
defer notifier.Destroy()
wfl.NewJob(wfl.NewWorkflow(wfl.NewProcessContext())).Run("sleep", "0").Notify(notifier)
job := notifier.ReceiveJob()
Ω(job).ShouldNot(BeNil())
ji := job.JobInfo()
Ω(ji).ShouldNot(BeNil())
})
})
})