-
Notifications
You must be signed in to change notification settings - Fork 539
/
Copy pathisFacetRefined.js
46 lines (37 loc) · 1.12 KB
/
isFacetRefined.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
'use strict';
var SearchParameters = require('../../../src/SearchParameters');
test('isFacetRefined returns true if value in facetsRefinements', function () {
var state = new SearchParameters({
facets: ['test'],
facetsRefinements: {
test: ['zongo'],
},
});
expect(state.isFacetRefined('test', 'zongo')).toBe(true);
});
test('isFacetRefined returns true if something is refined when not passing a value', function () {
var state = new SearchParameters({
facets: ['test'],
facetsRefinements: {
test: ['zongo'],
},
});
expect(state.isFacetRefined('test')).toBe(true);
});
test('isFacetRefined returns false if value not in facetsRefinements', function () {
var state = new SearchParameters({
facets: ['test'],
facetsRefinements: {
test: ['zongo'],
},
});
expect(state.isFacetRefined('test', 'not zongo')).toBe(false);
});
test('isFacetRefined returns false if facet is not conjunctive', function () {
var state = new SearchParameters({
facetsRefinements: {
test: ['zongo'],
},
});
expect(state.isFacetRefined('test', 'zongo')).toBe(false);
});