-
Notifications
You must be signed in to change notification settings - Fork 15
/
Copy pathchat_repository_test.go
38 lines (31 loc) · 967 Bytes
/
chat_repository_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
package margelet_test
import (
. "github.com/smartystreets/goconvey/convey"
"testing"
)
func TestChatRepository(t *testing.T) {
Convey("Given chat repository", t, func() {
m := getMargelet()
Convey("When new chat added", func() {
m.ChatRepository.Add(100500)
Convey("New chat should be found in repo", func() {
So(m.ChatRepository.All(), ShouldResemble, []int64{100500})
})
})
Convey("Given existing chats", func() {
m.ChatRepository.Add(100500)
m.ChatRepository.Add(100501)
m.ChatRepository.Add(100502)
m.ChatRepository.Add(100503)
Convey("When removing chat", func() {
m.ChatRepository.Remove(100500)
Convey("Removed chat should not be found in repo", func() {
So(m.ChatRepository.All(), ShouldResemble, []int64{100501, 100502, 100503})
})
})
Convey("Repo should return all chats", func() {
So(m.ChatRepository.All(), ShouldResemble, []int64{100500, 100501, 100502, 100503})
})
})
})
}