diff --git a/src/app/core/auth/auth.reducer.spec.ts b/src/app/core/auth/auth.reducer.spec.ts index 74c1637f85..af1b6626d0 100644 --- a/src/app/core/auth/auth.reducer.spec.ts +++ b/src/app/core/auth/auth.reducer.spec.ts @@ -114,9 +114,8 @@ describe('authReducer', () => { authToken: mockTokenInfo, loaded: false, error: undefined, - loading: false, - info: undefined, - user: EPersonMock + loading: true, + info: undefined }; expect(newState).toEqual(state); }); diff --git a/src/app/core/data/base-response-parsing.service.spec.ts b/src/app/core/data/base-response-parsing.service.spec.ts index c56c1de504..85f531e0ea 100644 --- a/src/app/core/data/base-response-parsing.service.spec.ts +++ b/src/app/core/data/base-response-parsing.service.spec.ts @@ -29,8 +29,10 @@ describe('BaseResponseParsingService', () => { const requestUUID = 'request-uuid'; const requestHref = 'request-href'; const request = new GetRequest(requestUUID, requestHref); + let obj: CacheableObject; beforeEach(() => { + obj = undefined; objectCache = jasmine.createSpyObj('objectCache', { add: {} }); @@ -38,8 +40,6 @@ describe('BaseResponseParsingService', () => { }); describe('cache', () => { - let obj: CacheableObject; - describe('when the object is undefined', () => { it('should not throw an error', () => { expect(() => { service.cache(obj, request, {}) }).not.toThrow(); diff --git a/src/app/core/data/dso-redirect-data.service.spec.ts b/src/app/core/data/dso-redirect-data.service.spec.ts index 4ef5bcb8b4..7c594cc554 100644 --- a/src/app/core/data/dso-redirect-data.service.spec.ts +++ b/src/app/core/data/dso-redirect-data.service.spec.ts @@ -34,12 +34,12 @@ describe('DsoRedirectDataService', () => { const http = {} as HttpClient; const comparator = {} as any; const objectCache = {} as ObjectCacheService; - let setup; + beforeEach(() => { scheduler = getTestScheduler(); halService = jasmine.createSpyObj('halService', { - getEndpoint: cold('a', {a: pidLink}) + getEndpoint: cold('a', { a: pidLink }) }); requestService = jasmine.createSpyObj('requestService', { generateRequestId: requestUUID, @@ -60,29 +60,26 @@ describe('DsoRedirectDataService', () => { } }; - setup = () => { - rdbService = jasmine.createSpyObj('rdbService', { - buildSingle: cold('a', { - a: remoteData - }) - }); - service = new DsoRedirectDataService( - requestService, - rdbService, - store, - objectCache, - halService, - notificationsService, - http, - comparator, - router - ); - } + rdbService = jasmine.createSpyObj('rdbService', { + buildSingle: cold('a', { + a: remoteData + }) + }); + service = new DsoRedirectDataService( + requestService, + rdbService, + store, + objectCache, + halService, + notificationsService, + http, + comparator, + router + ); }); describe('findById', () => { it('should call HALEndpointService with the path to the pid endpoint', () => { - setup(); scheduler.schedule(() => service.findByIdAndIDType(dsoHandle, IdentifierType.HANDLE)); scheduler.flush(); @@ -90,7 +87,6 @@ describe('DsoRedirectDataService', () => { }); it('should call HALEndpointService with the path to the dso endpoint', () => { - setup(); scheduler.schedule(() => service.findByIdAndIDType(dsoUUID, IdentifierType.UUID)); scheduler.flush(); @@ -98,7 +94,6 @@ describe('DsoRedirectDataService', () => { }); it('should call HALEndpointService with the path to the dso endpoint when identifier type not specified', () => { - setup(); scheduler.schedule(() => service.findByIdAndIDType(dsoUUID)); scheduler.flush(); @@ -106,7 +101,6 @@ describe('DsoRedirectDataService', () => { }); it('should configure the proper FindByIDRequest for uuid', () => { - setup(); scheduler.schedule(() => service.findByIdAndIDType(dsoUUID, IdentifierType.UUID)); scheduler.flush(); @@ -114,7 +108,6 @@ describe('DsoRedirectDataService', () => { }); it('should configure the proper FindByIDRequest for handle', () => { - setup(); scheduler.schedule(() => service.findByIdAndIDType(dsoHandle, IdentifierType.HANDLE)); scheduler.flush(); @@ -123,7 +116,6 @@ describe('DsoRedirectDataService', () => { it('should navigate to item route', () => { remoteData.payload.type = 'item'; - setup(); const redir = service.findByIdAndIDType(dsoHandle, IdentifierType.HANDLE); // The framework would normally subscribe but do it here so we can test navigation. redir.subscribe(); @@ -134,7 +126,6 @@ describe('DsoRedirectDataService', () => { it('should navigate to collections route', () => { remoteData.payload.type = 'collection'; - setup(); const redir = service.findByIdAndIDType(dsoHandle, IdentifierType.HANDLE); redir.subscribe(); scheduler.schedule(() => redir); @@ -144,7 +135,6 @@ describe('DsoRedirectDataService', () => { it('should navigate to communities route', () => { remoteData.payload.type = 'community'; - setup(); const redir = service.findByIdAndIDType(dsoHandle, IdentifierType.HANDLE); redir.subscribe(); scheduler.schedule(() => redir); diff --git a/src/app/shared/testing/auth-service.stub.ts b/src/app/shared/testing/auth-service.stub.ts index 83f91d36d3..a8711a7f96 100644 --- a/src/app/shared/testing/auth-service.stub.ts +++ b/src/app/shared/testing/auth-service.stub.ts @@ -29,14 +29,18 @@ export class AuthServiceStub { } } - public authenticatedUser(token: AuthTokenInfo): Observable { + public authenticatedUser(token: AuthTokenInfo): Observable { if (token.accessToken === 'token_test') { - return observableOf(EPersonMock); + return observableOf(EPersonMock._links.self.href); } else { throw(new Error('Message Error test')); } } + public retrieveAuthenticatedUserByHref(href: string): Observable { + return observableOf(EPersonMock); + } + public buildAuthHeader(token?: AuthTokenInfo): string { return `Bearer ${token.accessToken}`; } @@ -102,8 +106,4 @@ export class AuthServiceStub { isAuthenticated() { return observableOf(true); } - - redirectAfterLoginSuccess() { - return; - } } diff --git a/src/app/submission/sections/form/section-form.component.ts b/src/app/submission/sections/form/section-form.component.ts index debd03f663..58cda897b0 100644 --- a/src/app/submission/sections/form/section-form.component.ts +++ b/src/app/submission/sections/form/section-form.component.ts @@ -135,7 +135,6 @@ export class SubmissionSectionformComponent extends SectionModelComponent { protected sectionService: SectionsService, protected submissionService: SubmissionService, protected translate: TranslateService, - protected workspaceItemDataService: WorkspaceitemDataService, @Inject('collectionIdProvider') public injectedCollectionId: string, @Inject('sectionDataProvider') public injectedSectionData: SectionDataObject, @Inject('submissionIdProvider') public injectedSubmissionId: string) {