Commits

Vlad Nouski authored and github-actions[bot] committed 651b6a7d76c
refactor: code

(cherry picked from commit fbbbc18844b44f6f56b7c5f1f5e07e4886877d20)
No tags

src/app/item-page/edit-item-page/item-status/item-status.component.spec.ts

Modified
9 9 import { ActivatedRoute } from '@angular/router';
10 10 import { Item } from '../../../core/shared/item.model';
11 11 import { By } from '@angular/platform-browser';
12 12 import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
13 13 import { of as observableOf } from 'rxjs';
14 14 import { createSuccessfulRemoteDataObject, createSuccessfulRemoteDataObject$ } from '../../../shared/remote-data.utils';
15 15 import { AuthorizationDataService } from '../../../core/data/feature-authorization/authorization-data.service';
16 16 import { IdentifierDataService } from '../../../core/data/identifier-data.service';
17 17 import { ConfigurationDataService } from '../../../core/data/configuration-data.service';
18 18 import { ConfigurationProperty } from '../../../core/shared/configuration-property.model';
19 +import { OrcidAuthService } from '../../../core/orcid/orcid-auth.service';
19 20
20 21 let mockIdentifierDataService: IdentifierDataService;
21 22 let mockConfigurationDataService: ConfigurationDataService;
22 23
23 24 describe('ItemStatusComponent', () => {
24 25 let comp: ItemStatusComponent;
25 26 let fixture: ComponentFixture<ItemStatusComponent>;
26 27
27 28 const mockItem = Object.assign(new Item(), {
28 29 id: 'fake-id',
50 51
51 52 const itemPageUrl = `/items/${mockItem.uuid}`;
52 53
53 54 const routeStub = {
54 55 parent: {
55 56 data: observableOf({ dso: createSuccessfulRemoteDataObject(mockItem) })
56 57 }
57 58 };
58 59
59 60 let authorizationService: AuthorizationDataService;
61 + let orcidAuthService: any;
60 62
61 63 beforeEach(waitForAsync(() => {
62 64 authorizationService = jasmine.createSpyObj('authorizationService', {
63 65 isAuthorized: observableOf(true)
64 66 });
65 67
68 + orcidAuthService = jasmine.createSpyObj('OrcidAuthService', {
69 + onlyAdminCanDisconnectProfileFromOrcid: observableOf ( true ),
70 + isLinkedToOrcid: true
71 + });
72 +
66 73 TestBed.configureTestingModule({
67 74 imports: [CommonModule, RouterTestingModule.withRoutes([]), TranslateModule.forRoot(), NgbModule],
68 75 declarations: [ItemStatusComponent],
69 76 providers: [
70 77 { provide: ActivatedRoute, useValue: routeStub },
71 78 { provide: HostWindowService, useValue: new HostWindowServiceStub(0) },
72 79 { provide: AuthorizationDataService, useValue: authorizationService },
73 80 { provide: IdentifierDataService, useValue: mockIdentifierDataService },
74 - { provide: ConfigurationDataService, useValue: mockConfigurationDataService }
81 + { provide: ConfigurationDataService, useValue: mockConfigurationDataService },
82 + { provide: OrcidAuthService, useValue: orcidAuthService },
75 83 ], schemas: [CUSTOM_ELEMENTS_SCHEMA]
76 84 }).compileComponents();
77 85 }));
78 86
79 87 beforeEach(() => {
80 88 fixture = TestBed.createComponent(ItemStatusComponent);
81 89 comp = fixture.componentInstance;
82 90 fixture.detectChanges();
83 91 });
84 92

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut