-
Notifications
You must be signed in to change notification settings - Fork 0
/
batch_test.go
47 lines (42 loc) · 860 Bytes
/
batch_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
package resque
import (
"testing"
"github.com/stretchr/testify/require"
)
func TestClient_NewBatch(t *testing.T) {
tests := []struct {
queue string
shouldSuccess bool
}{
{
queue: "test",
shouldSuccess: true,
},
{
queue: "tutu",
shouldSuccess: true,
},
{
queue: "tata",
shouldSuccess: true,
},
{
queue: "",
shouldSuccess: false,
},
}
cli, err := New(Configuration{
RedisURI: "redis://localhost:6379",
})
require.Nil(t, err, "should be nil")
require.NotNil(t, cli, "should not be nil")
for _, test := range tests {
batch, err := cli.NewBatch(test.queue)
if test.shouldSuccess {
require.Nil(t, err, "should be nil")
require.Equal(t, test.queue, batch.queue, "should be of same queue")
} else {
require.NotNil(t, err, "should not be nil")
}
}
}