fixed some tests

This commit is contained in:
Lotte Hofstede
2018-04-04 14:25:57 +02:00
parent 86fcf44977
commit a232127422
19 changed files with 128 additions and 211 deletions

View File

@@ -13,6 +13,7 @@ import { CommunityDataService } from './community-data.service';
import { FindByIDRequest } from './request.models';
import { RequestService } from './request.service';
import { NormalizedObject } from '../cache/models/normalized-object.model';
import { HALEndpointService } from '../shared/hal-endpoint.service';
const LINK_NAME = 'test';
@@ -21,7 +22,6 @@ class NormalizedTestObject extends NormalizedObject {
}
class TestService extends ComColDataService<NormalizedTestObject, any> {
protected linkPath = LINK_NAME;
constructor(
protected responseCache: ResponseCacheService,
@@ -30,7 +30,9 @@ class TestService extends ComColDataService<NormalizedTestObject, any> {
protected store: Store<CoreState>,
protected EnvConfig: GlobalConfig,
protected cds: CommunityDataService,
protected objectCache: ObjectCacheService
protected objectCache: ObjectCacheService,
protected halService: HALEndpointService,
protected linkPath: string
) {
super();
}
@@ -44,6 +46,7 @@ describe('ComColDataService', () => {
let requestService: RequestService;
let cds: CommunityDataService;
let objectCache: ObjectCacheService;
const halService: any = {};
const rdbService = {} as RemoteDataBuildService;
const store = {} as Store<CoreState>;
@@ -90,7 +93,9 @@ describe('ComColDataService', () => {
store,
EnvConfig,
cds,
objectCache
objectCache,
halService,
LINK_NAME
);
}
@@ -154,24 +159,5 @@ describe('ComColDataService', () => {
});
});
describe('if the scope is not specified', () => {
beforeEach(() => {
cds = initMockCommunityDataService();
requestService = getMockRequestService();
objectCache = initMockObjectCacheService();
responseCache = initMockResponseCacheService(true);
service = initTestService();
});
it('should return this.getEndpoint()', () => {
spyOn(service, 'getEndpoint').and.returnValue(cold('--e-', { e: serviceEndpoint }));
const result = service.getScopedEndpoint(undefined);
const expected = cold('--f-', { f: serviceEndpoint });
expect(result).toBeObservable(expected);
});
});
});
});