Skip to content

Commit

Permalink
117616: Auto-fixed new linting rules
Browse files Browse the repository at this point in the history
  • Loading branch information
alexandrevryghem committed Oct 11, 2024
1 parent 49853db commit 1895066
Show file tree
Hide file tree
Showing 97 changed files with 299 additions and 333 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
NgbNavModule,
} from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule } from '@ngx-translate/core';
import { of } from 'rxjs';
import { of as observableOf } from 'rxjs';

import { buildPaginatedList } from '../../../core/data/paginated-list.model';
import { PageInfo } from '../../../core/shared/page-info.model';
Expand Down Expand Up @@ -70,7 +70,7 @@ describe('BulkAccessBrowseComponent', () => {
beforeEach(() => {
fixture = TestBed.createComponent(BulkAccessBrowseComponent);
component = fixture.componentInstance;
(component as any).selectableListService.getSelectableList.and.returnValue(of(testSelection));
(component as any).selectableListService.getSelectableList.and.returnValue(observableOf(testSelection));
fixture.detectChanges();
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { TranslateModule } from '@ngx-translate/core';
import { of } from 'rxjs';
import { of as observableOf } from 'rxjs';

import { Process } from '../../process-page/processes/process.model';
import { BulkAccessControlService } from '../../shared/access-control-form-container/bulk-access-control.service';
Expand Down Expand Up @@ -113,7 +113,7 @@ describe('BulkAccessComponent', () => {

beforeEach(() => {

(component as any).selectableListService.getSelectableList.and.returnValue(of(selectableListStateEmpty));
(component as any).selectableListService.getSelectableList.and.returnValue(observableOf(selectableListStateEmpty));
fixture.detectChanges();
component.settings = mockSettings;
});
Expand All @@ -136,7 +136,7 @@ describe('BulkAccessComponent', () => {

beforeEach(() => {

(component as any).selectableListService.getSelectableList.and.returnValue(of(selectableListState));
(component as any).selectableListService.getSelectableList.and.returnValue(observableOf(selectableListState));
fixture.detectChanges();
component.settings = mockSettings;
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import { TranslateModule } from '@ngx-translate/core';
import {
Observable,
of as observableOf,
of,
} from 'rxjs';

import { APP_DATA_SERVICES_MAP } from '../../../config/app-config.interface';
Expand Down Expand Up @@ -198,7 +197,7 @@ describe('GroupsRegistryComponent', () => {
};

configurationDataService = jasmine.createSpyObj('ConfigurationDataService', {
findByPropertyName: of({ payload: { value: 'test' } }),
findByPropertyName: observableOf({ payload: { value: 'test' } }),
});

authorizationService = jasmine.createSpyObj('authorizationService', ['isAuthorized']);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,7 @@ import {
TranslateService,
} from '@ngx-translate/core';
import { PaginationService } from 'ngx-pagination';
import {
of as observableOf,
of,
} from 'rxjs';
import { of as observableOf } from 'rxjs';

import { RouteService } from '../../../core/services/route.service';
import { MockActivatedRoute } from '../../../shared/mocks/active-router.mock';
Expand Down Expand Up @@ -85,7 +82,7 @@ describe('LdnServiceFormEditComponent', () => {


const translateServiceStub = {
get: () => of('translated-text'),
get: () => observableOf('translated-text'),
instant: () => 'translated-text',
onLangChange: new EventEmitter(),
onTranslationChange: new EventEmitter(),
Expand All @@ -100,7 +97,7 @@ describe('LdnServiceFormEditComponent', () => {
});

ldnItemfiltersService = {
findAll: () => of(['item1', 'item2']),
findAll: () => observableOf(['item1', 'item2']),
};
cdRefStub = Object.assign({
detectChanges: () => fixture.detectChanges(),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {
Observable,
of,
of as observableOf,
} from 'rxjs';

import { PaginatedList } from '../../../core/data/paginated-list.model';
Expand Down Expand Up @@ -112,4 +112,4 @@ export const mockLdnServices: LdnService[] = [{
},
},
];
export const mockLdnServicesRD$: Observable<RemoteData<PaginatedList<LdnService>>> = of((mockLdnServices as unknown) as RemoteData<PaginatedList<LdnService>>);
export const mockLdnServicesRD$: Observable<RemoteData<PaginatedList<LdnService>>> = observableOf((mockLdnServices as unknown) as RemoteData<PaginatedList<LdnService>>);
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
cold,
getTestScheduler,
} from 'jasmine-marbles';
import { of } from 'rxjs';
import { of as observableOf } from 'rxjs';
import { TestScheduler } from 'rxjs/testing';

import { RemoteDataBuildService } from '../../../core/cache/builders/remote-data-build.service';
Expand Down Expand Up @@ -59,12 +59,12 @@ describe('LdnItemfiltersService test', () => {
generateRequestId: requestUUID,
send: true,
removeByHrefSubstring: {},
getByHref: of(responseCacheEntry),
getByUUID: of(responseCacheEntry),
getByHref: observableOf(responseCacheEntry),
getByUUID: observableOf(responseCacheEntry),
});

halService = jasmine.createSpyObj('halService', {
getEndpoint: of(endpointURL),
getEndpoint: observableOf(endpointURL),
});

rdbService = jasmine.createSpyObj('rdbService', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
TranslateModule,
TranslateService,
} from '@ngx-translate/core';
import { of } from 'rxjs';
import { of as observableOf } from 'rxjs';

import { PaginatedList } from '../../../core/data/paginated-list.model';
import { RemoteData } from '../../../core/data/remote-data';
Expand All @@ -41,7 +41,7 @@ describe('LdnServicesOverviewComponent', () => {
let modalService: NgbModal;

const translateServiceStub = {
get: () => of('translated-text'),
get: () => observableOf('translated-text'),
onLangChange: new EventEmitter(),
onTranslationChange: new EventEmitter(),
onDefaultLangChange: new EventEmitter(),
Expand Down Expand Up @@ -96,7 +96,7 @@ describe('LdnServicesOverviewComponent', () => {
modalService = TestBed.inject(NgbModal);
component.modalRef = jasmine.createSpyObj({ close: null });
component.isProcessingSub = jasmine.createSpyObj({ unsubscribe: null });
component.ldnServicesRD$ = of({} as RemoteData<PaginatedList<LdnService>>);
component.ldnServicesRD$ = observableOf({} as RemoteData<PaginatedList<LdnService>>);
fixture.detectChanges();
});

Expand Down Expand Up @@ -162,7 +162,7 @@ describe('LdnServicesOverviewComponent', () => {
const serviceId = '123';
const mockRemoteData = { /* just an empty object to retrieve as as RemoteData<PaginatedList<LdnService>> */};
spyOn(component, 'setLdnServices').and.callThrough();
const deleteSpy = ldnServicesService.delete.and.returnValue(of(mockRemoteData as RemoteData<PaginatedList<LdnService>>));
const deleteSpy = ldnServicesService.delete.and.returnValue(observableOf(mockRemoteData as RemoteData<PaginatedList<LdnService>>));
component.selectedServiceId = serviceId;
component.deleteSelected(serviceId, ldnServicesService);
tick();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@ import {
import { RouterModule } from '@angular/router';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule } from '@ngx-translate/core';
import {
of as observableOf,
of,
} from 'rxjs';
import { of as observableOf } from 'rxjs';

import { SearchConfigurationService } from '../../../core/shared/search/search-configuration.service';
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-configuration.service';
Expand Down Expand Up @@ -87,11 +84,11 @@ describe('AdminNotifySearchResultComponent', () => {

beforeEach(async () => {
adminNotifyMessageService = jasmine.createSpyObj('adminNotifyMessageService', {
getDetailedMessages: of(mockAdminNotifyMessages),
reprocessMessage: of(mockAdminNotifyMessages),
getDetailedMessages: observableOf(mockAdminNotifyMessages),
reprocessMessage: observableOf(mockAdminNotifyMessages),
});
searchConfigService = jasmine.createSpyObj('searchConfigService', {
getCurrentConfiguration: of('NOTIFY.outgoing'),
getCurrentConfiguration: observableOf('NOTIFY.outgoing'),
});

await TestBed.configureTestingModule({
Expand Down Expand Up @@ -150,7 +147,7 @@ describe('AdminNotifySearchResultComponent', () => {
});

it('should unsubscribe on destroy', () => {
(component as any).subs = [of(null).subscribe()];
(component as any).subs = [observableOf(null).subscribe()];

spyOn((component as any).subs[0], 'unsubscribe');
component.ngOnDestroy();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { deepClone } from 'fast-json-patch';
import { cold } from 'jasmine-marbles';
import {
BehaviorSubject,
of,
of as observableOf,
} from 'rxjs';
import { take } from 'rxjs/operators';

Expand Down Expand Up @@ -67,12 +67,12 @@ describe('AdminNotifyMessagesService test', () => {
generateRequestId: requestUUID,
send: true,
removeByHrefSubstring: {},
getByHref: of(responseCacheEntry),
getByUUID: of(responseCacheEntry),
getByHref: observableOf(responseCacheEntry),
getByUUID: observableOf(responseCacheEntry),
});

halService = jasmine.createSpyObj('halService', {
getEndpoint: of(endpointURL),
getEndpoint: observableOf(endpointURL),
});

rdbService = jasmine.createSpyObj('rdbService', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {
BehaviorSubject,
from,
Observable,
of,
of as observableOf,
scan,
} from 'rxjs';
import {
Expand Down Expand Up @@ -64,13 +64,13 @@ export class AdminNotifyMessagesService extends IdentifiableDataService<AdminNot
message.target || message.origin ? this.ldnServicesService.findById((message.target || message.origin).toString()).pipe(
getAllSucceededRemoteDataPayload(),
map(detail => ({ ...message, ldnService: detail.name })),
) : of(message),
) : observableOf(message),
),
mergeMap(message =>
message.object || message.context ? this.itemDataService.findById(message.object || message.context).pipe(
getAllSucceededRemoteDataPayload(),
map(detail => ({ ...message, relatedItem: detail.name })),
) : of(message),
) : observableOf(message),
),
scan((acc: any, value: any) => [...acc, value], []),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
import { By } from '@angular/platform-browser';
import { RouterTestingModule } from '@angular/router/testing';
import { TranslateModule } from '@ngx-translate/core';
import { of } from 'rxjs';
import { of as observableOf } from 'rxjs';

import { RemoteData } from '../../../../../core/data/remote-data';
import { RequestEntryState } from '../../../../../core/data/request-entry-state.model';
Expand All @@ -33,7 +33,7 @@ describe('WorkflowItemAdminWorkflowActionsComponent', () => {
id = '780b2588-bda5-4112-a1cd-0b15000a5339';
wfi = new WorkflowItem();
wfi.id = id;
wfi.item = of(rd);
wfi.item = observableOf(rd);
}

beforeEach(waitForAsync(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
NgbPaginationModule,
} from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule } from '@ngx-translate/core';
import { of } from 'rxjs';
import { of as observableOf } from 'rxjs';

import { Group } from '../../../../../../core/eperson/models/group.model';
import { SupervisionOrder } from '../../../../../../core/supervision-order/models/supervision-order.model';
Expand All @@ -29,7 +29,7 @@ describe('SupervisionOrderGroupSelectorComponent', () => {
const modalStub = jasmine.createSpyObj('modalStub', ['close']);

const supervisionOrderDataService: any = jasmine.createSpyObj('supervisionOrderDataService', {
create: of(new SupervisionOrder()),
create: observableOf(new SupervisionOrder()),
});

const selectedOrderType = 'NONE';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { By } from '@angular/platform-browser';
import { RouterTestingModule } from '@angular/router/testing';
import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule } from '@ngx-translate/core';
import { of } from 'rxjs';
import { of as observableOf } from 'rxjs';

import { DSONameService } from '../../../../../core/breadcrumbs/dso-name.service';
import { RemoteData } from '../../../../../core/data/remote-data';
Expand Down Expand Up @@ -46,7 +46,7 @@ describe('WorkspaceItemAdminWorkflowActionsComponent', () => {
id = '780b2588-bda5-4112-a1cd-0b15000a5339';
wsi = new WorkspaceItem();
wsi.id = id;
wsi.item = of(rd);
wsi.item = observableOf(rd);
}

beforeEach(waitForAsync(() => {
Expand Down Expand Up @@ -96,14 +96,14 @@ describe('WorkspaceItemAdminWorkflowActionsComponent', () => {
beforeEach(() => {
spyOn(component.delete, 'emit');
spyOn((component as any).modalService, 'open').and.returnValue({
componentInstance: { response: of(true) },
componentInstance: { response: observableOf(true) },
});
});

describe('when delete succeeded', () => {

beforeEach(() => {
supervisionOrderDataService.delete.and.returnValue(of(true));
supervisionOrderDataService.delete.and.returnValue(observableOf(true));
});

it('should notify success', () => {
Expand All @@ -118,7 +118,7 @@ describe('WorkspaceItemAdminWorkflowActionsComponent', () => {
describe('when delete failed', () => {

beforeEach(() => {
supervisionOrderDataService.delete.and.returnValue(of(false));
supervisionOrderDataService.delete.and.returnValue(observableOf(false));
});

it('should notify success', () => {
Expand All @@ -137,7 +137,7 @@ describe('WorkspaceItemAdminWorkflowActionsComponent', () => {
beforeEach(() => {
spyOn(component.create, 'emit');
spyOn((component as any).modalService, 'open').and.returnValue({
componentInstance: { create: of(true) },
componentInstance: { create: observableOf(true) },
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import {
TestBed,
} from '@angular/core/testing';
import { ActivatedRoute } from '@angular/router';
import {
of as observableOf,
of,
} from 'rxjs';
import { of as observableOf } from 'rxjs';

import { Community } from '../../../core/shared/community.model';
import { AccessControlFormContainerComponent } from '../../../shared/access-control-form-container/access-control-form-container.component';
Expand Down Expand Up @@ -35,7 +32,7 @@ describe('CollectionAccessControlComponent', () => {
const routeStub = {
parent: {
parent: {
data: of({
data: observableOf({
dso: createSuccessfulRemoteDataObject(testCommunity),
}),
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,7 @@ import {
TestBed,
} from '@angular/core/testing';
import { ActivatedRoute } from '@angular/router';
import {
of as observableOf,
of,
} from 'rxjs';
import { of as observableOf } from 'rxjs';

import { Community } from '../../../core/shared/community.model';
import { AccessControlFormContainerComponent } from '../../../shared/access-control-form-container/access-control-form-container.component';
Expand Down Expand Up @@ -36,7 +33,7 @@ describe('CommunityAccessControlComponent', () => {
const routeStub = {
parent: {
parent: {
data: of({
data: observableOf({
dso: createSuccessfulRemoteDataObject(testCommunity),
}),
},
Expand Down
Loading

0 comments on commit 1895066

Please sign in to comment.