69432: Test fixes

This commit is contained in:
Kristof De Langhe
2020-03-12 17:18:28 +01:00
parent 5c096d5f66
commit d9e6d25da0

View File

@@ -8,17 +8,19 @@ import { EPersonDataService } from '../../core/eperson/eperson-data.service';
import { NotificationsService } from '../../shared/notifications/notifications.service'; import { NotificationsService } from '../../shared/notifications/notifications.service';
import { FormBuilderService } from '../../shared/form/builder/form-builder.service'; import { FormBuilderService } from '../../shared/form/builder/form-builder.service';
import { ProfilePageSecurityFormComponent } from './profile-page-security-form.component'; import { ProfilePageSecurityFormComponent } from './profile-page-security-form.component';
import { of as observableOf } from 'rxjs';
import { RestResponse } from '../../core/cache/response.models';
describe('ProfilePageSecurityFormComponent', () => { describe('ProfilePageSecurityFormComponent', () => {
let component: ProfilePageSecurityFormComponent; let component: ProfilePageSecurityFormComponent;
let fixture: ComponentFixture<ProfilePageSecurityFormComponent>; let fixture: ComponentFixture<ProfilePageSecurityFormComponent>;
const user = new EPerson(); const user = Object.assign(new EPerson(), {
_links: {
self: { href: 'user-selflink' }
}
});
const epersonService = jasmine.createSpyObj('epersonService', { const epersonService = jasmine.createSpyObj('epersonService', {
immediatePatch: observableOf(new RestResponse(true, 200, 'OK')) patch: {}
}); });
const notificationsService = jasmine.createSpyObj('notificationsService', { const notificationsService = jasmine.createSpyObj('notificationsService', {
success: {}, success: {},
@@ -58,8 +60,8 @@ describe('ProfilePageSecurityFormComponent', () => {
expect(result).toEqual(false); expect(result).toEqual(false);
}); });
it('should not call epersonService.immediatePatch', () => { it('should not call epersonService.patch', () => {
expect(epersonService.immediatePatch).not.toHaveBeenCalled(); expect(epersonService.patch).not.toHaveBeenCalled();
}); });
}); });
@@ -91,8 +93,8 @@ describe('ProfilePageSecurityFormComponent', () => {
expect(result).toEqual(true); expect(result).toEqual(true);
}); });
it('should return call epersonService.immediatePatch', () => { it('should return call epersonService.patch', () => {
expect(epersonService.immediatePatch).toHaveBeenCalledWith(user, operations); expect(epersonService.patch).toHaveBeenCalledWith(user.self, operations);
}); });
}); });
}); });