Skip to content

Commit

Permalink
Add missing UTs
Browse files Browse the repository at this point in the history
  • Loading branch information
dmbrooke committed Aug 22, 2023
1 parent 4f88e95 commit 56c894f
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,34 @@ describe('search parameter manager', () => {
});
});

describe('#state.parameters.fExcluded', () => {
it('only includes excluded values when a facet has some', () => {
const excluded = buildMockFacetValueRequest({
value: 'a',
state: 'excluded',
});
const idle = buildMockFacetValueRequest({value: 'b', state: 'idle'});
const selected = buildMockFacetValueRequest({
value: 'c',
state: 'selected',
});

const currentValues = [excluded, idle, selected];
engine.state.facetSet = {
author: buildMockFacetSlice({
request: buildMockFacetRequest({currentValues}),
}),
};

expect(manager.state.parameters.fExcluded).toEqual({author: ['a']});
});

it('is not included when there are no facets with selected values', () => {
engine.state.facetSet = {author: buildMockFacetSlice()};
expect(manager.state.parameters).not.toContain('fExcluded');
});
});

describe('#state.parameters.cf', () => {
it('only includes selected values when a category facet has some', () => {
const selected = buildMockCategoryFacetValueRequest({
Expand Down Expand Up @@ -309,7 +337,6 @@ describe('search parameter manager', () => {
});
engine.state.automaticFacetSet.set = {a: slice};


engine.state.query.q = 'a';
engine.state.sortCriteria = 'qre';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,14 +103,14 @@ function testFacetExcludeLogging(
action2: SearchAction
) => void
) {
/*testFacetLogging('fExcluded', expectIdenticalActionType);
testFacetLogging('fExcluded', expectIdenticalActionType);

it('should log #logFacetSelect when an fExcluded parameter is added', () => {
expectIdenticalActionType(
logParametersChange({}, {fExcluded: {author: ['Cervantes']}}),
logFacetExclude({facetId: 'author', facetValue: 'Cervantes'})
);
});*/
});

it('should log #logFacetSelect when an fExcluded parameter is modified & a value added', () => {
expectIdenticalActionType(
Expand Down

0 comments on commit 56c894f

Please sign in to comment.