1- import { redis } from '../helpers/mock-redis'
1+ import { redis , commandOptions } from '../helpers/mock-redis'
22import { Client } from '$lib/client' ;
33
44
@@ -22,7 +22,9 @@ describe("Client", () => {
2222 query : 'query'
2323 } ) ;
2424 expect ( redis . sendCommand ) . toHaveBeenCalledWith ( [
25- 'FT.SEARCH' , 'index' , 'query' ] ) ;
25+ 'FT.SEARCH' , 'index' , 'query' ] ,
26+ commandOptions ( { returnBuffers : true } )
27+ ) ;
2628 } ) ;
2729
2830 it ( "sends the expect command when given a limit" , async ( ) => {
@@ -32,7 +34,9 @@ describe("Client", () => {
3234 limit : { offset : 0 , count : 5 }
3335 } ) ;
3436 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+ ) ;
3640 } ) ;
3741
3842 it ( "sends the expected command when given a sort" , async ( ) => {
@@ -42,7 +46,9 @@ describe("Client", () => {
4246 sort : { field : 'sortField' , order : 'ASC' }
4347 } ) ;
4448 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+ ) ;
4652 } ) ;
4753
4854 it ( "sends the expected command when keysOnly is set to false" , async ( ) => {
@@ -52,7 +58,9 @@ describe("Client", () => {
5258 keysOnly : false
5359 } ) ;
5460 expect ( redis . sendCommand ) . toHaveBeenCalledWith ( [
55- 'FT.SEARCH' , 'index' , 'query' ] ) ;
61+ 'FT.SEARCH' , 'index' , 'query' ] ,
62+ commandOptions ( { returnBuffers : true } )
63+ ) ;
5664 } ) ;
5765
5866 it ( "sends the expected command when keysOnly is set to true" , async ( ) => {
@@ -62,7 +70,9 @@ describe("Client", () => {
6270 keysOnly : true
6371 } ) ;
6472 expect ( redis . sendCommand ) . toHaveBeenCalledWith ( [
65- 'FT.SEARCH' , 'index' , 'query' , 'RETURN' , '0' ] ) ;
73+ 'FT.SEARCH' , 'index' , 'query' , 'RETURN' , '0' ] ,
74+ commandOptions ( { returnBuffers : true } )
75+ ) ;
6676 } ) ;
6777
6878 it ( "sends the expected command with all options" , async ( ) => {
@@ -75,7 +85,9 @@ describe("Client", () => {
7585 } ) ;
7686 expect ( redis . sendCommand ) . toHaveBeenCalledWith ( [
7787 'FT.SEARCH' , 'index' , 'query' , 'LIMIT' , '0' , '5' ,
78- 'SORTBY' , 'sortField' , 'ASC' , 'RETURN' , '0' ] ) ;
88+ 'SORTBY' , 'sortField' , 'ASC' , 'RETURN' , '0' ] ,
89+ commandOptions ( { returnBuffers : true } )
90+ ) ;
7991 } ) ;
8092 } ) ;
8193
0 commit comments