Skip to content

Commit a2a463b

Browse files
committed
test: add test case for setting and scanning durations
1 parent 2f1b74e commit a2a463b

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

redis_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,6 +300,18 @@ var _ = Describe("Client", func() {
300300
Expect(tm2).To(BeTemporally("==", tm))
301301
})
302302

303+
It("should set and scan durations", func() {
304+
duration := 10 * time.Minute
305+
err := client.Set(ctx, "duration", duration, 0).Err()
306+
Expect(err).NotTo(HaveOccurred())
307+
308+
var duration2 time.Duration
309+
err = client.Get(ctx, "duration").Scan(&duration2)
310+
Expect(err).NotTo(HaveOccurred())
311+
312+
Expect(duration2).To(Equal(duration))
313+
})
314+
303315
It("should Conn", func() {
304316
err := client.Conn(ctx).Get(ctx, "this-key-does-not-exist").Err()
305317
Expect(err).To(Equal(redis.Nil))

0 commit comments

Comments
 (0)