mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-18 07:23:03 +00:00
68405: test fixes
This commit is contained in:

committed by
Art Lowel

parent
ab0f2c89e6
commit
884e94a08b
@@ -27,7 +27,6 @@ describe('ObjectCacheService', () => {
|
||||
const timestamp = new Date().getTime();
|
||||
const msToLive = 900000;
|
||||
let objectToCache = {
|
||||
self: selfLink,
|
||||
type: Item.type,
|
||||
_links: {
|
||||
self: { href: selfLink }
|
||||
@@ -39,7 +38,6 @@ describe('ObjectCacheService', () => {
|
||||
|
||||
function init() {
|
||||
objectToCache = {
|
||||
self: selfLink,
|
||||
type: Item.type,
|
||||
_links: {
|
||||
self: { href: selfLink }
|
||||
@@ -115,12 +113,13 @@ describe('ObjectCacheService', () => {
|
||||
|
||||
describe('getList', () => {
|
||||
it('should return an observable of the array of cached objects with the specified self link and type', () => {
|
||||
const item = new Item();
|
||||
item._links.self = { href: selfLink };
|
||||
const item = Object.assign(new Item(), {
|
||||
_links: { self: { href: selfLink } }
|
||||
});
|
||||
spyOn(service, 'getObjectBySelfLink').and.returnValue(observableOf(item));
|
||||
|
||||
service.getList([selfLink, selfLink]).pipe(first()).subscribe((arr) => {
|
||||
expect(arr[0].self).toBe(selfLink);
|
||||
expect(arr[0]._links.self.href).toBe(selfLink);
|
||||
expect(arr[0] instanceof Item).toBeTruthy();
|
||||
});
|
||||
});
|
||||
|
@@ -1,22 +1,22 @@
|
||||
import { TestBed } from '@angular/core/testing';
|
||||
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import { provideMockActions } from '@ngrx/effects/testing';
|
||||
import { Store, StoreModule } from '@ngrx/store';
|
||||
import { cold, hot } from 'jasmine-marbles';
|
||||
|
||||
import { ServerSyncBufferEffects } from './server-sync-buffer.effects';
|
||||
import { GLOBAL_CONFIG } from '../../../config';
|
||||
import { CommitSSBAction, EmptySSBAction, ServerSyncBufferActionTypes } from './server-sync-buffer.actions';
|
||||
import { RestRequestMethod } from '../data/rest-request-method';
|
||||
import { Store, StoreModule } from '@ngrx/store';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { ObjectCacheService } from './object-cache.service';
|
||||
import { MockStore } from '../../shared/testing/mock-store';
|
||||
import { Observable, of as observableOf } from 'rxjs';
|
||||
import * as operators from 'rxjs/operators';
|
||||
import { spyOnOperator } from '../../shared/testing/utils';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { GLOBAL_CONFIG } from '../../../config';
|
||||
import { getMockRequestService } from '../../shared/mocks/mock-request.service';
|
||||
import { MockStore } from '../../shared/testing/mock-store';
|
||||
import { spyOnOperator } from '../../shared/testing/utils';
|
||||
import { RequestService } from '../data/request.service';
|
||||
import { RestRequestMethod } from '../data/rest-request-method';
|
||||
import { DSpaceObject } from '../shared/dspace-object.model';
|
||||
import { ApplyPatchObjectCacheAction } from './object-cache.actions';
|
||||
import { ObjectCacheService } from './object-cache.service';
|
||||
import { CommitSSBAction, EmptySSBAction, ServerSyncBufferActionTypes } from './server-sync-buffer.actions';
|
||||
|
||||
import { ServerSyncBufferEffects } from './server-sync-buffer.effects';
|
||||
|
||||
describe('ServerSyncBufferEffects', () => {
|
||||
let ssbEffects: ServerSyncBufferEffects;
|
||||
@@ -47,8 +47,9 @@ describe('ServerSyncBufferEffects', () => {
|
||||
{
|
||||
provide: ObjectCacheService, useValue: {
|
||||
getObjectBySelfLink: (link) => {
|
||||
const object = new DSpaceObject();
|
||||
object._links.self = { href: link };
|
||||
const object = Object.assign(new DSpaceObject(), {
|
||||
_links: { self: { href: link } }
|
||||
});
|
||||
return observableOf(object);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user