1
- import { redis } from '../helpers/mock-redis'
1
+ import { redis , commandOptions } from '../helpers/mock-redis'
2
2
import { Client } from '$lib/client' ;
3
3
4
4
@@ -22,7 +22,9 @@ describe("Client", () => {
22
22
query : 'query'
23
23
} ) ;
24
24
expect ( redis . sendCommand ) . toHaveBeenCalledWith ( [
25
- 'FT.SEARCH' , 'index' , 'query' ] ) ;
25
+ 'FT.SEARCH' , 'index' , 'query' ] ,
26
+ commandOptions ( { returnBuffers : true } )
27
+ ) ;
26
28
} ) ;
27
29
28
30
it ( "sends the expect command when given a limit" , async ( ) => {
@@ -32,7 +34,9 @@ describe("Client", () => {
32
34
limit : { offset : 0 , count : 5 }
33
35
} ) ;
34
36
expect ( redis . sendCommand ) . toHaveBeenCalledWith ( [
35
- 'FT.SEARCH' , 'index' , 'query' , 'LIMIT' , '0' , '5' ] ) ;
37
+ 'FT.SEARCH' , 'index' , 'query' , 'LIMIT' , '0' , '5' ] ,
38
+ commandOptions ( { returnBuffers : true } )
39
+ ) ;
36
40
} ) ;
37
41
38
42
it ( "sends the expected command when given a sort" , async ( ) => {
@@ -42,7 +46,9 @@ describe("Client", () => {
42
46
sort : { field : 'sortField' , order : 'ASC' }
43
47
} ) ;
44
48
expect ( redis . sendCommand ) . toHaveBeenCalledWith ( [
45
- 'FT.SEARCH' , 'index' , 'query' , 'SORTBY' , 'sortField' , 'ASC' ] ) ;
49
+ 'FT.SEARCH' , 'index' , 'query' , 'SORTBY' , 'sortField' , 'ASC' ] ,
50
+ commandOptions ( { returnBuffers : true } )
51
+ ) ;
46
52
} ) ;
47
53
48
54
it ( "sends the expected command when keysOnly is set to false" , async ( ) => {
@@ -52,7 +58,9 @@ describe("Client", () => {
52
58
keysOnly : false
53
59
} ) ;
54
60
expect ( redis . sendCommand ) . toHaveBeenCalledWith ( [
55
- 'FT.SEARCH' , 'index' , 'query' ] ) ;
61
+ 'FT.SEARCH' , 'index' , 'query' ] ,
62
+ commandOptions ( { returnBuffers : true } )
63
+ ) ;
56
64
} ) ;
57
65
58
66
it ( "sends the expected command when keysOnly is set to true" , async ( ) => {
@@ -62,7 +70,9 @@ describe("Client", () => {
62
70
keysOnly : true
63
71
} ) ;
64
72
expect ( redis . sendCommand ) . toHaveBeenCalledWith ( [
65
- 'FT.SEARCH' , 'index' , 'query' , 'RETURN' , '0' ] ) ;
73
+ 'FT.SEARCH' , 'index' , 'query' , 'RETURN' , '0' ] ,
74
+ commandOptions ( { returnBuffers : true } )
75
+ ) ;
66
76
} ) ;
67
77
68
78
it ( "sends the expected command with all options" , async ( ) => {
@@ -75,7 +85,9 @@ describe("Client", () => {
75
85
} ) ;
76
86
expect ( redis . sendCommand ) . toHaveBeenCalledWith ( [
77
87
'FT.SEARCH' , 'index' , 'query' , 'LIMIT' , '0' , '5' ,
78
- 'SORTBY' , 'sortField' , 'ASC' , 'RETURN' , '0' ] ) ;
88
+ 'SORTBY' , 'sortField' , 'ASC' , 'RETURN' , '0' ] ,
89
+ commandOptions ( { returnBuffers : true } )
90
+ ) ;
79
91
} ) ;
80
92
} ) ;
81
93
0 commit comments