forked from golang-queue/queue
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathoptions_test.go
More file actions
44 lines (41 loc) · 872 Bytes
/
options_test.go
File metadata and controls
44 lines (41 loc) · 872 Bytes
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
package queue
import (
"testing"
"time"
)
func TestWithRetryInterval(t *testing.T) {
tests := []struct {
name string
duration time.Duration
want time.Duration
}{
{
name: "Set 2 seconds retry interval",
duration: 2 * time.Second,
want: 2 * time.Second,
},
{
name: "Set 500ms retry interval",
duration: 500 * time.Millisecond,
want: 500 * time.Millisecond,
},
{
name: "Set zero retry interval",
duration: 0,
want: 0,
},
{
name: "Set negative retry interval",
duration: -1 * time.Second,
want: -1 * time.Second,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
opts := NewOptions(WithRetryInterval(tt.duration))
if opts.retryInterval != tt.want {
t.Errorf("WithRetryInterval() = %v, want %v", opts.retryInterval, tt.want)
}
})
}
}