mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-15 05:53:03 +00:00
Add tests and fix tests
This commit is contained in:
@@ -8,6 +8,12 @@ import { Community } from '../../core/shared/community.model';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { DSpaceObject } from '../../core/shared/dspace-object.model';
|
||||
import { SearchService } from '../../core/shared/search/search.service';
|
||||
import { PaginationComponentOptions } from '../pagination/pagination-component-options.model';
|
||||
import { SortDirection, SortOptions } from '../../core/cache/models/sort-options.model';
|
||||
import { FindListOptions } from '../../core/data/request.models';
|
||||
import { of as observableOf } from 'rxjs';
|
||||
import { PaginationService } from '../../core/pagination/pagination.service';
|
||||
import { SearchConfigurationService } from '../../core/shared/search/search-configuration.service';
|
||||
|
||||
describe('SearchFormComponent', () => {
|
||||
let comp: SearchFormComponent;
|
||||
@@ -15,6 +21,19 @@ describe('SearchFormComponent', () => {
|
||||
let de: DebugElement;
|
||||
let el: HTMLElement;
|
||||
|
||||
const pagination = Object.assign(new PaginationComponentOptions(), { currentPage: 1, pageSize: 20 });
|
||||
const sort = new SortOptions('score', SortDirection.DESC);
|
||||
const findlistOptions = Object.assign(new FindListOptions(), { currentPage: 1, elementsPerPage: 20 });
|
||||
const paginationService = jasmine.createSpyObj('PaginationService', {
|
||||
getCurrentPagination: observableOf(pagination),
|
||||
getCurrentSort: observableOf(sort),
|
||||
getFindListOptions: observableOf(findlistOptions),
|
||||
resetPage: {},
|
||||
updateRouteWithUrl: {}
|
||||
});
|
||||
|
||||
const searchConfigService = {paginationID: 'test-id'};
|
||||
|
||||
beforeEach(waitForAsync(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [FormsModule, RouterTestingModule, TranslateModule.forRoot()],
|
||||
@@ -22,7 +41,9 @@ describe('SearchFormComponent', () => {
|
||||
{
|
||||
provide: SearchService,
|
||||
useValue: {}
|
||||
}
|
||||
},
|
||||
{ provide: PaginationService, useValue: paginationService },
|
||||
{ provide: SearchConfigurationService, useValue: searchConfigService }
|
||||
],
|
||||
declarations: [SearchFormComponent]
|
||||
}).compileComponents();
|
||||
|
Reference in New Issue
Block a user