5
5
6
6
. "github.com/bsm/ginkgo/v2"
7
7
. "github.com/bsm/gomega"
8
+
8
9
"github.com/redis/go-redis/v9"
9
10
)
10
11
@@ -13,7 +14,6 @@ type JSONGetTestStruct struct {
13
14
}
14
15
15
16
var _ = Describe ("JSON Commands" , Label ("json" ), func () {
16
-
17
17
ctx := context .TODO ()
18
18
var client * redis.Client
19
19
@@ -27,7 +27,6 @@ var _ = Describe("JSON Commands", Label("json"), func() {
27
27
})
28
28
29
29
Describe ("arrays" , Label ("arrays" ), func () {
30
-
31
30
It ("should JSONArrAppend" , Label ("json.arrappend" , "json" ), func () {
32
31
cmd1 := client .JSONSet (ctx , "append2" , "$" , `{"a": [10], "b": {"a": [12, 13]}}` )
33
32
Expect (cmd1 .Err ()).NotTo (HaveOccurred ())
@@ -76,7 +75,6 @@ var _ = Describe("JSON Commands", Label("json"), func() {
76
75
res , err = client .JSONArrIndexWithArgs (ctx , "index2" , "$" , & redis.JSONArrIndexArgs {Stop : & stop }, 4 ).Result ()
77
76
Expect (err ).NotTo (HaveOccurred ())
78
77
Expect (res [0 ]).To (Equal (int64 (- 1 )))
79
-
80
78
})
81
79
82
80
It ("should JSONArrIndex and JSONArrIndexWithArgs with $" , Label ("json.arrindex" , "json" ), func () {
@@ -235,7 +233,6 @@ var _ = Describe("JSON Commands", Label("json"), func() {
235
233
Expect (cmd3 .Err ()).NotTo (HaveOccurred ())
236
234
Expect (cmd3 .Val ()).To (Equal ("[[100,200,200]]" ))
237
235
})
238
-
239
236
})
240
237
241
238
Describe ("get/set" , Label ("getset" ), func () {
@@ -257,7 +254,6 @@ var _ = Describe("JSON Commands", Label("json"), func() {
257
254
res , err = client .JSONGetWithArgs (ctx , "get3" , & redis.JSONGetArgs {Indent : "-" , Newline : `~` , Space : `!` }).Result ()
258
255
Expect (err ).NotTo (HaveOccurred ())
259
256
Expect (res ).To (Equal (`[~-{~--"a":!1,~--"b":!2~-}~]` ))
260
-
261
257
})
262
258
263
259
It ("should JSONMerge" , Label ("json.merge" , "json" ), func () {
@@ -330,13 +326,10 @@ var _ = Describe("JSON Commands", Label("json"), func() {
330
326
iRes , err = client .JSONMGet (ctx , "$..a" , "non_existing_doc" , "non_existing_doc1" ).Result ()
331
327
Expect (err ).NotTo (HaveOccurred ())
332
328
Expect (iRes ).To (Equal ([]interface {}{nil , nil }))
333
-
334
329
})
335
-
336
330
})
337
331
338
332
Describe ("Misc" , Label ("misc" ), func () {
339
-
340
333
It ("should JSONClear" , Label ("json.clear" , "json" ), func () {
341
334
cmd1 := client .JSONSet (ctx , "clear1" , "$" , `[1]` )
342
335
Expect (cmd1 .Err ()).NotTo (HaveOccurred ())
@@ -460,7 +453,6 @@ var _ = Describe("JSON Commands", Label("json"), func() {
460
453
cmd3 := client .JSONGet (ctx , "forget3" , "$" )
461
454
Expect (cmd3 .Err ()).NotTo (HaveOccurred ())
462
455
Expect (cmd3 .Val ()).To (Equal (`[{"b":{"b":"annie"}}]` ))
463
-
464
456
})
465
457
466
458
It ("should JSONForget with $" , Label ("json.forget" , "json" ), func () {
@@ -622,7 +614,6 @@ var _ = Describe("JSON Commands", Label("json"), func() {
622
614
cmd3 , err := client .JSONGet (ctx , "strapp1" , "$" ).Result ()
623
615
Expect (err ).NotTo (HaveOccurred ())
624
616
Expect (cmd3 ).To (Equal (`["foobar"]` ))
625
-
626
617
})
627
618
628
619
It ("should JSONStrAppend and JSONStrLen with $" , Label ("json.strappend" , "json.strlen" , "json" ), func () {
0 commit comments