fixing tests

This commit is contained in:
lotte
2019-12-20 08:55:23 +01:00
parent a5ed837180
commit 9d185e8a15
5 changed files with 8 additions and 7 deletions

View File

@@ -192,7 +192,7 @@ describe('DataService', () => {
dso2.self = selfLink;
dso2.metadata = [{ key: 'dc.title', value: name2 }];
spyOn(service, 'findByHref').and.returnValues(createSuccessfulRemoteDataObject$(dso));
spyOn(service, 'findByHref').and.returnValue(createSuccessfulRemoteDataObject$(dso));
spyOn(objectCache, 'addPatch');
});

View File

@@ -123,8 +123,8 @@ describe('RelationshipService', () => {
it('should clear the related items their cache', () => {
expect(objectCache.remove).toHaveBeenCalledWith(relatedItem1.self);
expect(objectCache.remove).toHaveBeenCalledWith(item.self);
expect(requestService.removeByHrefSubstring).toHaveBeenCalledWith(relatedItem1.self);
expect(requestService.removeByHrefSubstring).toHaveBeenCalledWith(item.self);
expect(requestService.removeByHrefSubstring).toHaveBeenCalledWith(relatedItem1.uuid);
expect(requestService.removeByHrefSubstring).toHaveBeenCalledWith(item.uuid);
});
});

View File

@@ -150,7 +150,7 @@ export class RelationshipService extends DataService<Relationship> {
this.requestService.removeByHrefSubstring(item.uuid);
combineLatest(
this.objectCache.hasBySelfLinkObservable(item.self),
this.requestService.hasByHrefObservable(item.self)
this.requestService.hasByHrefObservable(item.uuid)
).pipe(
filter(([existsInOC, existsInRC]) => !existsInOC && !existsInRC),
take(1),

View File

@@ -16,7 +16,7 @@ import { NO_ERRORS_SCHEMA } from '@angular/core';
import { By } from '@angular/platform-browser';
import { of } from 'rxjs/internal/observable/of';
describe('ItemSelectComponent', () => {
fdescribe('ItemSelectComponent', () => {
let comp: ItemSelectComponent;
let fixture: ComponentFixture<ItemSelectComponent>;
let objectSelectService: ObjectSelectService;

View File

@@ -4,7 +4,7 @@ import { TranslateModule } from '@ngx-translate/core';
import { ChangeDetectionStrategy, NO_ERRORS_SCHEMA } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { Observable, of as observableOf } from 'rxjs';
import { Params } from '@angular/router';
import { Params, Router } from '@angular/router';
import { SearchLabelComponent } from './search-label.component';
import { ObjectKeysPipe } from '../../../utils/object-keys-pipe';
import { SEARCH_CONFIG_SERVICE } from '../../../../+my-dspace-page/my-dspace-page.component';
@@ -39,7 +39,8 @@ describe('SearchLabelComponent', () => {
declarations: [SearchLabelComponent, ObjectKeysPipe],
providers: [
{ provide: SearchService, useValue: new SearchServiceStub(searchLink) },
{ provide: SEARCH_CONFIG_SERVICE, useValue: new SearchConfigurationServiceStub() }
{ provide: SEARCH_CONFIG_SERVICE, useValue: new SearchConfigurationServiceStub() },
{ provide: Router, useValue: {}}
// { provide: SearchConfigurationService, useValue: {getCurrentFrontendFilters : () => observableOf({})} }
],
schemas: [NO_ERRORS_SCHEMA]