mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 10:34:15 +00:00
fixed test
This commit is contained in:
@@ -19,9 +19,10 @@ import { By } from '@angular/platform-browser';
|
|||||||
describe('SearchFacetOptionComponent', () => {
|
describe('SearchFacetOptionComponent', () => {
|
||||||
let comp: SearchFacetOptionComponent;
|
let comp: SearchFacetOptionComponent;
|
||||||
let fixture: ComponentFixture<SearchFacetOptionComponent>;
|
let fixture: ComponentFixture<SearchFacetOptionComponent>;
|
||||||
const filterName1 = 'test name';
|
const filterName1 = 'testname';
|
||||||
const value1 = 'testvalue1';
|
const value1 = 'testvalue1';
|
||||||
const value2 = 'test2';
|
const value2 = 'test2';
|
||||||
|
const operator = 'equals';
|
||||||
const value3 = 'another value3';
|
const value3 = 'another value3';
|
||||||
const mockFilterConfig = Object.assign(new SearchFilterConfig(), {
|
const mockFilterConfig = Object.assign(new SearchFilterConfig(), {
|
||||||
name: filterName1,
|
name: filterName1,
|
||||||
@@ -36,7 +37,7 @@ describe('SearchFacetOptionComponent', () => {
|
|||||||
label: value2,
|
label: value2,
|
||||||
value: value2,
|
value: value2,
|
||||||
count: 20,
|
count: 20,
|
||||||
search: ''
|
search: `http://test.org/api/discover/search/objects?f.${filterName1}=${value2},${operator}`
|
||||||
};
|
};
|
||||||
|
|
||||||
const searchLink = '/search';
|
const searchLink = '/search';
|
||||||
@@ -91,12 +92,12 @@ describe('SearchFacetOptionComponent', () => {
|
|||||||
fixture.detectChanges();
|
fixture.detectChanges();
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('when the updateAddParams method is called wih a value', () => {
|
describe('when the updateAddParams method is called with a value', () => {
|
||||||
it('should update the addQueryParams with the new parameter values', () => {
|
it('should update the addQueryParams with the new parameter values', () => {
|
||||||
comp.addQueryParams = {};
|
comp.addQueryParams = {};
|
||||||
(comp as any).updateAddParams(selectedValues);
|
(comp as any).updateAddParams(selectedValues);
|
||||||
expect(comp.addQueryParams).toEqual({
|
expect(comp.addQueryParams).toEqual({
|
||||||
[mockFilterConfig.paramName]: [value1, value.value],
|
[mockFilterConfig.paramName]: [value1, `${value2},${operator}`],
|
||||||
page: 1
|
page: 1
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Reference in New Issue
Block a user