@@ -137,11 +137,11 @@ describe('getRefinements', function() {
137137 hierarchicalFacets : [ {
138138 name : 'hierarchicalFacet1' ,
139139 attributes : [ 'hierarchicalFacet1.lvl0' , 'hierarchicalFacet1.lvl1' ] ,
140- separator : '> '
140+ separator : ' > '
141141 } , {
142142 name : 'hierarchicalFacet2' ,
143143 attributes : [ 'hierarchicalFacet2.lvl0' , 'hierarchicalFacet2.lvl1' ] ,
144- separator : '> '
144+ separator : ' > '
145145 } ]
146146 } ) ;
147147 results = { } ;
@@ -150,24 +150,24 @@ describe('getRefinements', function() {
150150 it ( 'should retrieve one tag' , function ( ) {
151151 helper . addTag ( 'tag1' ) ;
152152 const expected = [
153- { attributeName : '_tags' , name : 'tag1' }
153+ { type : 'tag' , attributeName : '_tags' , name : 'tag1' }
154154 ] ;
155155 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
156156 } ) ;
157157
158158 it ( 'should retrieve multiple tags' , function ( ) {
159159 helper . addTag ( 'tag1' ) . addTag ( 'tag2' ) ;
160160 const expected = [
161- { attributeName : '_tags' , name : 'tag1' } ,
162- { attributeName : '_tags' , name : 'tag2' }
161+ { type : 'tag' , attributeName : '_tags' , name : 'tag1' } ,
162+ { type : 'tag' , attributeName : '_tags' , name : 'tag2' }
163163 ] ;
164164 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
165165 } ) ;
166166
167167 it ( 'should retrieve one facetRefinement' , function ( ) {
168168 helper . toggleRefinement ( 'facet1' , 'facet1val1' ) ;
169169 const expected = [
170- { attributeName : 'facet1' , name : 'facet1val1' }
170+ { type : 'facet' , attributeName : 'facet1' , name : 'facet1val1' }
171171 ] ;
172172 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
173173 } ) ;
@@ -177,8 +177,8 @@ describe('getRefinements', function() {
177177 . toggleRefinement ( 'facet1' , 'facet1val1' )
178178 . toggleRefinement ( 'facet1' , 'facet1val2' ) ;
179179 const expected = [
180- { attributeName : 'facet1' , name : 'facet1val1' } ,
181- { attributeName : 'facet1' , name : 'facet1val2' }
180+ { type : 'facet' , attributeName : 'facet1' , name : 'facet1val1' } ,
181+ { type : 'facet' , attributeName : 'facet1' , name : 'facet1val2' }
182182 ] ;
183183 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
184184 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 1 ] ) ;
@@ -190,9 +190,9 @@ describe('getRefinements', function() {
190190 . toggleRefinement ( 'facet1' , 'facet1val2' )
191191 . toggleRefinement ( 'facet2' , 'facet2val1' ) ;
192192 const expected = [
193- { attributeName : 'facet1' , name : 'facet1val1' } ,
194- { attributeName : 'facet1' , name : 'facet1val2' } ,
195- { attributeName : 'facet2' , name : 'facet2val1' }
193+ { type : 'facet' , attributeName : 'facet1' , name : 'facet1val1' } ,
194+ { type : 'facet' , attributeName : 'facet1' , name : 'facet1val2' } ,
195+ { type : 'facet' , attributeName : 'facet2' , name : 'facet2val1' }
196196 ] ;
197197 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
198198 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 1 ] ) ;
@@ -210,7 +210,7 @@ describe('getRefinements', function() {
210210 } ]
211211 } ;
212212 const expected = [
213- { attributeName : 'facet1' , name : 'facet1val1' , count : 4 }
213+ { type : 'facet' , attributeName : 'facet1' , name : 'facet1val1' , count : 4 }
214214 ] ;
215215 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
216216 } ) ;
@@ -224,15 +224,15 @@ describe('getRefinements', function() {
224224 } ]
225225 } ;
226226 const expected = [
227- { attributeName : 'facet1' , name : 'facet1val1' , exhaustive : true }
227+ { type : 'facet' , attributeName : 'facet1' , name : 'facet1val1' , exhaustive : true }
228228 ] ;
229229 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
230230 } ) ;
231231
232232 it ( 'should retrieve one facetExclude' , function ( ) {
233233 helper . toggleExclude ( 'facet1' , 'facet1exclude1' ) ;
234234 const expected = [
235- { attributeName : 'facet1' , name : 'facet1exclude1' , exclude : true }
235+ { type : 'exclude' , attributeName : 'facet1' , name : 'facet1exclude1' , exclude : true }
236236 ] ;
237237 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
238238 } ) ;
@@ -242,8 +242,8 @@ describe('getRefinements', function() {
242242 . toggleExclude ( 'facet1' , 'facet1exclude1' )
243243 . toggleExclude ( 'facet1' , 'facet1exclude2' ) ;
244244 const expected = [
245- { attributeName : 'facet1' , name : 'facet1exclude1' , exclude : true } ,
246- { attributeName : 'facet1' , name : 'facet1exclude2' , exclude : true }
245+ { type : 'exclude' , attributeName : 'facet1' , name : 'facet1exclude1' , exclude : true } ,
246+ { type : 'exclude' , attributeName : 'facet1' , name : 'facet1exclude2' , exclude : true }
247247 ] ;
248248 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
249249 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 1 ] ) ;
@@ -255,9 +255,9 @@ describe('getRefinements', function() {
255255 . toggleExclude ( 'facet1' , 'facet1exclude2' )
256256 . toggleExclude ( 'facet2' , 'facet2exclude1' ) ;
257257 const expected = [
258- { attributeName : 'facet1' , name : 'facet1exclude1' , exclude : true } ,
259- { attributeName : 'facet1' , name : 'facet1exclude2' , exclude : true } ,
260- { attributeName : 'facet2' , name : 'facet2exclude1' , exclude : true }
258+ { type : 'exclude' , attributeName : 'facet1' , name : 'facet1exclude1' , exclude : true } ,
259+ { type : 'exclude' , attributeName : 'facet1' , name : 'facet1exclude2' , exclude : true } ,
260+ { type : 'exclude' , attributeName : 'facet2' , name : 'facet2exclude1' , exclude : true }
261261 ] ;
262262 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
263263 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 1 ] ) ;
@@ -267,7 +267,7 @@ describe('getRefinements', function() {
267267 it ( 'should retrieve one disjunctiveFacetRefinement' , function ( ) {
268268 helper . addDisjunctiveFacetRefinement ( 'disjunctiveFacet1' , 'disjunctiveFacet1val1' ) ;
269269 const expected = [
270- { attributeName : 'disjunctiveFacet1' , name : 'disjunctiveFacet1val1' }
270+ { type : 'disjunctive' , attributeName : 'disjunctiveFacet1' , name : 'disjunctiveFacet1val1' }
271271 ] ;
272272 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
273273 } ) ;
@@ -277,8 +277,8 @@ describe('getRefinements', function() {
277277 . addDisjunctiveFacetRefinement ( 'disjunctiveFacet1' , 'disjunctiveFacet1val1' )
278278 . addDisjunctiveFacetRefinement ( 'disjunctiveFacet1' , 'disjunctiveFacet1val2' ) ;
279279 const expected = [
280- { attributeName : 'disjunctiveFacet1' , name : 'disjunctiveFacet1val1' } ,
281- { attributeName : 'disjunctiveFacet1' , name : 'disjunctiveFacet1val2' }
280+ { type : 'disjunctive' , attributeName : 'disjunctiveFacet1' , name : 'disjunctiveFacet1val1' } ,
281+ { type : 'disjunctive' , attributeName : 'disjunctiveFacet1' , name : 'disjunctiveFacet1val2' }
282282 ] ;
283283 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
284284 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 1 ] ) ;
@@ -290,9 +290,9 @@ describe('getRefinements', function() {
290290 . toggleRefinement ( 'disjunctiveFacet1' , 'disjunctiveFacet1val2' )
291291 . toggleRefinement ( 'disjunctiveFacet2' , 'disjunctiveFacet2val1' ) ;
292292 const expected = [
293- { attributeName : 'disjunctiveFacet1' , name : 'disjunctiveFacet1val1' } ,
294- { attributeName : 'disjunctiveFacet1' , name : 'disjunctiveFacet1val2' } ,
295- { attributeName : 'disjunctiveFacet2' , name : 'disjunctiveFacet2val1' }
293+ { type : 'disjunctive' , attributeName : 'disjunctiveFacet1' , name : 'disjunctiveFacet1val1' } ,
294+ { type : 'disjunctive' , attributeName : 'disjunctiveFacet1' , name : 'disjunctiveFacet1val2' } ,
295+ { type : 'disjunctive' , attributeName : 'disjunctiveFacet2' , name : 'disjunctiveFacet2val1' }
296296 ] ;
297297 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
298298 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 1 ] ) ;
@@ -310,7 +310,7 @@ describe('getRefinements', function() {
310310 } ]
311311 } ;
312312 const expected = [
313- { attributeName : 'disjunctiveFacet1' , name : 'disjunctiveFacet1val1' , count : 4 }
313+ { type : 'disjunctive' , attributeName : 'disjunctiveFacet1' , name : 'disjunctiveFacet1val1' , count : 4 }
314314 ] ;
315315 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
316316 } ) ;
@@ -324,15 +324,15 @@ describe('getRefinements', function() {
324324 } ]
325325 } ;
326326 const expected = [
327- { attributeName : 'disjunctiveFacet1' , name : 'disjunctiveFacet1val1' , exhaustive : true }
327+ { type : 'disjunctive' , attributeName : 'disjunctiveFacet1' , name : 'disjunctiveFacet1val1' , exhaustive : true }
328328 ] ;
329329 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
330330 } ) ;
331331
332332 it ( 'should retrieve one hierarchicalFacetRefinement' , function ( ) {
333333 helper . toggleRefinement ( 'hierarchicalFacet1' , 'hierarchicalFacet1lvl0val1' ) ;
334334 const expected = [
335- { attributeName : 'hierarchicalFacet1' , name : 'hierarchicalFacet1lvl0val1' }
335+ { type : 'hierarchical' , attributeName : 'hierarchicalFacet1' , name : 'hierarchicalFacet1lvl0val1' }
336336 ] ;
337337 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
338338 } ) ;
@@ -342,8 +342,8 @@ describe('getRefinements', function() {
342342 . toggleRefinement ( 'hierarchicalFacet1' , 'hierarchicalFacet1lvl0val1' )
343343 . toggleRefinement ( 'hierarchicalFacet2' , 'hierarchicalFacet2lvl0val1' ) ;
344344 const expected = [
345- { attributeName : 'hierarchicalFacet1' , name : 'hierarchicalFacet1lvl0val1' } ,
346- { attributeName : 'hierarchicalFacet2' , name : 'hierarchicalFacet2lvl0val1' }
345+ { type : 'hierarchical' , attributeName : 'hierarchicalFacet1' , name : 'hierarchicalFacet1lvl0val1' } ,
346+ { type : 'hierarchical' , attributeName : 'hierarchicalFacet2' , name : 'hierarchicalFacet2lvl0val1' }
347347 ] ;
348348 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
349349 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 1 ] ) ;
@@ -354,8 +354,8 @@ describe('getRefinements', function() {
354354 . toggleRefinement ( 'hierarchicalFacet1' , 'hierarchicalFacet1lvl0val1' )
355355 . toggleRefinement ( 'hierarchicalFacet2' , 'hierarchicalFacet2lvl0val1 > lvl1val1' ) ;
356356 const expected = [
357- { attributeName : 'hierarchicalFacet1' , name : 'hierarchicalFacet1lvl0val1' } ,
358- { attributeName : 'hierarchicalFacet2' , name : 'hierarchicalFacet2lvl0val1 > lvl1val1' }
357+ { type : 'hierarchical' , attributeName : 'hierarchicalFacet1' , name : 'hierarchicalFacet1lvl0val1' } ,
358+ { type : 'hierarchical' , attributeName : 'hierarchicalFacet2' , name : 'lvl1val1' }
359359 ] ;
360360 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
361361 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 1 ] ) ;
@@ -367,12 +367,12 @@ describe('getRefinements', function() {
367367 hierarchicalFacets : [ {
368368 name : 'hierarchicalFacet1' ,
369369 data : {
370- hierarchicalFacet1val1 : 4
370+ hierarchicalFacet1val1 : { name : 'hierarchicalFacet1val1' , count : 4 }
371371 }
372372 } ]
373373 } ;
374374 const expected = [
375- { attributeName : 'hierarchicalFacet1' , name : 'hierarchicalFacet1val1' , count : 4 }
375+ { type : 'hierarchical' , attributeName : 'hierarchicalFacet1' , name : 'hierarchicalFacet1val1' , count : 4 }
376376 ] ;
377377 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
378378 } ) ;
@@ -382,27 +382,29 @@ describe('getRefinements', function() {
382382 results = {
383383 hierarchicalFacets : [ {
384384 name : 'hierarchicalFacet1' ,
385- exhaustive : true
385+ data : [
386+ { name : 'hierarchicalFacet1val1' , exhaustive : true }
387+ ]
386388 } ]
387389 } ;
388390 const expected = [
389- { attributeName : 'hierarchicalFacet1' , name : 'hierarchicalFacet1val1' , exhaustive : true }
391+ { type : 'hierarchical' , attributeName : 'hierarchicalFacet1' , name : 'hierarchicalFacet1val1' , exhaustive : true }
390392 ] ;
391393 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
392394 } ) ;
393395
394396 it ( 'should retrieve a numericRefinement on one facet' , function ( ) {
395397 helper . addNumericRefinement ( 'numericFacet1' , '>' , '1' ) ;
396398 const expected = [
397- { attributeName : 'numericFacet1' , operator : '>' , name : '1' }
399+ { type : 'numeric' , attributeName : 'numericFacet1' , operator : '>' , name : '1' }
398400 ] ;
399401 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
400402 } ) ;
401403
402404 it ( 'should retrieve a numericRefinement on one disjunctive facet' , function ( ) {
403405 helper . addNumericRefinement ( 'numericDisjunctiveFacet1' , '>' , '1' ) ;
404406 const expected = [
405- { attributeName : 'numericDisjunctiveFacet1' , operator : '>' , name : '1' }
407+ { type : 'numeric' , attributeName : 'numericDisjunctiveFacet1' , operator : '>' , name : '1' }
406408 ] ;
407409 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
408410 } ) ;
@@ -412,8 +414,8 @@ describe('getRefinements', function() {
412414 . addNumericRefinement ( 'numericFacet1' , '>' , '1' )
413415 . addNumericRefinement ( 'numericFacet1' , '>' , '2' ) ;
414416 const expected = [
415- { attributeName : 'numericFacet1' , operator : '>' , name : '1' } ,
416- { attributeName : 'numericFacet1' , operator : '>' , name : '2' }
417+ { type : 'numeric' , attributeName : 'numericFacet1' , operator : '>' , name : '1' } ,
418+ { type : 'numeric' , attributeName : 'numericFacet1' , operator : '>' , name : '2' }
417419 ] ;
418420 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
419421 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 1 ] ) ;
@@ -427,11 +429,11 @@ describe('getRefinements', function() {
427429 . addNumericRefinement ( 'numericDisjunctiveFacet1' , '>' , '1' )
428430 . addNumericRefinement ( 'numericDisjunctiveFacet1' , '>' , '2' ) ;
429431 const expected = [
430- { attributeName : 'numericFacet1' , operator : '>' , name : '1' } ,
431- { attributeName : 'numericFacet1' , operator : '>' , name : '2' } ,
432- { attributeName : 'numericFacet1' , operator : '<=' , name : '3' } ,
433- { attributeName : 'numericDisjunctiveFacet1' , operator : '>' , name : '1' } ,
434- { attributeName : 'numericDisjunctiveFacet1' , operator : '>' , name : '2' }
432+ { type : 'numeric' , attributeName : 'numericFacet1' , operator : '>' , name : '1' } ,
433+ { type : 'numeric' , attributeName : 'numericFacet1' , operator : '>' , name : '2' } ,
434+ { type : 'numeric' , attributeName : 'numericFacet1' , operator : '<=' , name : '3' } ,
435+ { type : 'numeric' , attributeName : 'numericDisjunctiveFacet1' , operator : '>' , name : '1' } ,
436+ { type : 'numeric' , attributeName : 'numericDisjunctiveFacet1' , operator : '>' , name : '2' }
435437 ] ;
436438 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 0 ] ) ;
437439 expect ( utils . getRefinements ( results , helper . state ) ) . toInclude ( expected [ 1 ] ) ;
0 commit comments