mirror of
https://github.com/DSpace/dspace-angular.git
synced 2025-10-08 18:44:14 +00:00
fix test dependencies, move components in two tabs
This commit is contained in:
@@ -12,12 +12,19 @@
|
||||
</div>
|
||||
</ng-template>
|
||||
</li>
|
||||
<li [ngbNavItem]="'logs'" (click)="activateTableMode()">
|
||||
<a ngbNavLink>{{'admin-notify-dashboard.logs' | translate}}</a>
|
||||
<li [ngbNavItem]="'inbound'" (click)="activateTableMode()">
|
||||
<a ngbNavLink>{{'admin.notify.dashboard.inbound' | translate}}</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div id="logs">
|
||||
<div id="inbound">
|
||||
<div class="col-12 text-left h4 my-4">{{'admin.notify.dashboard.inbound' | translate}}</div>
|
||||
<ds-admin-notify-incoming></ds-admin-notify-incoming>
|
||||
</div>
|
||||
</ng-template>
|
||||
</li>
|
||||
<li [ngbNavItem]="'outbound'" (click)="activateTableMode()">
|
||||
<a ngbNavLink>{{'admin.notify.dashboard.outbound'| translate}}</a>
|
||||
<ng-template ngbNavContent>
|
||||
<div id="outbound">
|
||||
<div class="col-12 text-left h4 my-4">{{'admin.notify.dashboard.outbound' | translate}}</div>
|
||||
<ds-admin-notify-outgoing></ds-admin-notify-outgoing>
|
||||
</div>
|
||||
|
@@ -3,16 +3,52 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AdminNotifyIncomingComponent } from './admin-notify-incoming.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { MockActivatedRoute } from "../../../../shared/mocks/active-router.mock";
|
||||
import { provideMockStore } from "@ngrx/store/testing";
|
||||
import { HALEndpointService } from "../../../../core/shared/hal-endpoint.service";
|
||||
import { SEARCH_CONFIG_SERVICE } from "../../../../my-dspace-page/my-dspace-page.component";
|
||||
import { AdminNotifySearchConfigurationService } from "../../config/admin-notify-search-configuration.service";
|
||||
import { FILTER_SEARCH } from "../../admin-notify-dashboard.component";
|
||||
import { AdminNotifySearchFilterService } from "../../config/admin-notify-filter-service";
|
||||
import { FILTER_CONFIG } from "../../../../core/shared/search/search-filter.service";
|
||||
import { RouteService } from "../../../../core/services/route.service";
|
||||
import { routeServiceStub } from "../../../../shared/testing/route-service.stub";
|
||||
import { RequestService } from "../../../../core/data/request.service";
|
||||
import { RemoteDataBuildService } from "../../../../core/cache/builders/remote-data-build.service";
|
||||
import { getMockRemoteDataBuildService } from "../../../../shared/mocks/remote-data-build.service.mock";
|
||||
|
||||
describe('AdminNotifyLogsComponent', () => {
|
||||
describe('AdminNotifyIncomingComponent', () => {
|
||||
let component: AdminNotifyIncomingComponent;
|
||||
let fixture: ComponentFixture<AdminNotifyIncomingComponent>;
|
||||
let halService: HALEndpointService;
|
||||
let requestService: RequestService;
|
||||
let rdbService: RemoteDataBuildService;
|
||||
|
||||
|
||||
|
||||
beforeEach(async () => {
|
||||
rdbService = getMockRemoteDataBuildService();
|
||||
halService = jasmine.createSpyObj('halService', {
|
||||
'getRootHref': '/api'
|
||||
});
|
||||
requestService = jasmine.createSpyObj('requestService', {
|
||||
'generateRequestId': 'client/1234',
|
||||
'send': '',
|
||||
});
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot()],
|
||||
declarations: [ AdminNotifyIncomingComponent ],
|
||||
providers: [ActivatedRoute]
|
||||
providers: [
|
||||
{ provide: SEARCH_CONFIG_SERVICE, useValue: AdminNotifySearchConfigurationService },
|
||||
{ provide: FILTER_SEARCH, useValue: AdminNotifySearchFilterService },
|
||||
{ provide: FILTER_CONFIG, useValue: AdminNotifySearchConfigurationService },
|
||||
{ provide: RouteService, useValue: routeServiceStub },
|
||||
{ provide: ActivatedRoute, useValue: new MockActivatedRoute() },
|
||||
{ provide: HALEndpointService, useValue: halService },
|
||||
{ provide: RequestService, useValue: requestService },
|
||||
{ provide: RemoteDataBuildService, useValue: rdbService },
|
||||
provideMockStore({}),
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
@@ -3,16 +3,51 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
import { AdminNotifyOutgoingComponent } from './admin-notify-outgoing.component';
|
||||
import { TranslateModule } from '@ngx-translate/core';
|
||||
import { ActivatedRoute } from "@angular/router";
|
||||
import { MockActivatedRoute } from "../../../../shared/mocks/active-router.mock";
|
||||
import { provideMockStore } from "@ngrx/store/testing";
|
||||
import { HALEndpointService } from "../../../../core/shared/hal-endpoint.service";
|
||||
import { SEARCH_CONFIG_SERVICE } from "../../../../my-dspace-page/my-dspace-page.component";
|
||||
import { AdminNotifySearchConfigurationService } from "../../config/admin-notify-search-configuration.service";
|
||||
import { FILTER_SEARCH } from "../../admin-notify-dashboard.component";
|
||||
import { AdminNotifySearchFilterService } from "../../config/admin-notify-filter-service";
|
||||
import { FILTER_CONFIG } from "../../../../core/shared/search/search-filter.service";
|
||||
import { RouteService } from "../../../../core/services/route.service";
|
||||
import { routeServiceStub } from "../../../../shared/testing/route-service.stub";
|
||||
import { RequestService } from "../../../../core/data/request.service";
|
||||
import { getMockRemoteDataBuildService } from "../../../../shared/mocks/remote-data-build.service.mock";
|
||||
import { RemoteDataBuildService } from "../../../../core/cache/builders/remote-data-build.service";
|
||||
|
||||
describe('AdminNotifyLogsComponent', () => {
|
||||
describe('AdminNotifyOutgoingComponent', () => {
|
||||
let component: AdminNotifyOutgoingComponent;
|
||||
let fixture: ComponentFixture<AdminNotifyOutgoingComponent>;
|
||||
let halService: HALEndpointService;
|
||||
let requestService: RequestService;
|
||||
let rdbService: RemoteDataBuildService;
|
||||
|
||||
|
||||
beforeEach(async () => {
|
||||
rdbService = getMockRemoteDataBuildService();
|
||||
requestService = jasmine.createSpyObj('requestService', {
|
||||
'generateRequestId': 'client/1234',
|
||||
'send': '',
|
||||
});
|
||||
halService = jasmine.createSpyObj('halService', {
|
||||
'getRootHref': '/api'
|
||||
});
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot()],
|
||||
declarations: [ AdminNotifyOutgoingComponent ],
|
||||
providers: [ActivatedRoute]
|
||||
providers: [
|
||||
{ provide: SEARCH_CONFIG_SERVICE, useValue: AdminNotifySearchConfigurationService },
|
||||
{ provide: FILTER_SEARCH, useValue: AdminNotifySearchFilterService },
|
||||
{ provide: FILTER_CONFIG, useValue: AdminNotifySearchConfigurationService },
|
||||
{ provide: RouteService, useValue: routeServiceStub },
|
||||
{ provide: ActivatedRoute, useValue: new MockActivatedRoute() },
|
||||
{ provide: HALEndpointService, useValue: halService },
|
||||
{ provide: RequestService, useValue: requestService },
|
||||
{ provide: RemoteDataBuildService, useValue: rdbService },
|
||||
provideMockStore({}),
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
@@ -12,7 +12,6 @@ import {
|
||||
import { PaginatedList } from '../../../core/data/paginated-list.model';
|
||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
|
||||
import { AdminNotifyDetailModalComponent } from '../admin-notify-detail-modal/admin-notify-detail-modal.component';
|
||||
import { objects } from "../../../shared/search/search-results/search-results.component.spec";
|
||||
|
||||
@tabulatableObjectsComponent(PaginatedList<AdminNotifySearchResult>, ViewMode.Table, Context.CoarNotify)
|
||||
@Component({
|
||||
@@ -32,8 +31,7 @@ export class AdminNotifySearchResultComponent extends TabulatableResultListElem
|
||||
* Map messages on init for readable representation
|
||||
*/
|
||||
ngOnInit() {
|
||||
console.log(this.objects.page.splice(0,2))
|
||||
this.notifyMessages = this.objects.page.map(object => {
|
||||
this.notifyMessages = this.objects?.page.map(object => {
|
||||
const indexableObject = object.indexableObject;
|
||||
indexableObject.coarNotifyType = indexableObject.coarNotifyType.split(':')[1];
|
||||
indexableObject.queueStatusLabel = QueueStatusMap[indexableObject.queueStatusLabel];
|
||||
|
@@ -7,6 +7,15 @@ import { ListableObject } from "../listable-object.model";
|
||||
import { PaginatedList } from "../../../../core/data/paginated-list.model";
|
||||
import { Context } from "../../../../core/shared/context.model";
|
||||
import { GenericConstructor } from "../../../../core/shared/generic-constructor";
|
||||
import { TabulatableObjectsDirective } from "./tabulatable-objects.directive";
|
||||
import { ListableObjectComponentLoaderComponent } from "../listable-object/listable-object-component-loader.component";
|
||||
import { ChangeDetectionStrategy } from "@angular/core";
|
||||
import {
|
||||
ItemListElementComponent
|
||||
} from "../../../object-list/item-list-element/item-types/item/item-list-element.component";
|
||||
import {
|
||||
TabulatableResultListElementsComponent
|
||||
} from "../../../object-list/search-result-list-element/tabulatable-search-result/tabulatable-result-list-elements.component";
|
||||
|
||||
const testType = 'TestType';
|
||||
class TestType extends ListableObject {
|
||||
@@ -16,7 +25,7 @@ class TestType extends ListableObject {
|
||||
}
|
||||
|
||||
class TestTypes extends PaginatedList<ListableObject> {
|
||||
page: TestType[]
|
||||
page: TestType[] = [new TestType()]
|
||||
}
|
||||
|
||||
|
||||
@@ -27,19 +36,27 @@ describe('TabulatableObjectsLoaderComponent', () => {
|
||||
let themeService: ThemeService;
|
||||
|
||||
beforeEach(async () => {
|
||||
themeService = jasmine.createSpyObj('themeService', {
|
||||
getThemeName: 'dspace',
|
||||
});
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ TabulatableObjectsLoaderComponent ],
|
||||
declarations: [ TabulatableObjectsLoaderComponent, TabulatableObjectsDirective ],
|
||||
providers: [
|
||||
provideMockStore({}),
|
||||
{ provide: ThemeService, useValue: themeService },
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
}).overrideComponent(TabulatableObjectsLoaderComponent, {
|
||||
set: {
|
||||
changeDetection: ChangeDetectionStrategy.Default,
|
||||
entryComponents: [TabulatableResultListElementsComponent]
|
||||
}
|
||||
}).compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(TabulatableObjectsLoaderComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.objects = new TestTypes();
|
||||
component.context = Context.Search;
|
||||
spyOn(component, 'getComponent').and.returnValue(TabulatableResultListElementsComponent as any);
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
|
@@ -148,7 +148,7 @@ export class TabulatableObjectsLoaderComponent implements OnInit, OnChanges, OnD
|
||||
|
||||
private instantiateComponent(objects: PaginatedList<ListableObject>, changes?: SimpleChanges): void {
|
||||
// objects need to have same render type so we access just the first in the page
|
||||
const component = this.getComponent(objects.page[0]?.getRenderTypes(), this.viewMode, this.context);
|
||||
const component = this.getComponent(objects?.page[0]?.getRenderTypes(), this.viewMode, this.context);
|
||||
|
||||
const viewContainerRef = this.tabulatableObjectsDirective.viewContainerRef;
|
||||
viewContainerRef.clear();
|
||||
|
@@ -19,6 +19,7 @@ import { PaginationComponentOptions } from '../../../../../pagination/pagination
|
||||
import { PaginationService } from '../../../../../../core/pagination/pagination.service';
|
||||
import { PaginationServiceStub } from '../../../../../testing/pagination-service.stub';
|
||||
import { ShortNumberPipe } from '../../../../../utils/short-number.pipe';
|
||||
import { FILTER_SEARCH } from "../../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
describe('SearchFacetOptionComponent', () => {
|
||||
let comp: SearchFacetOptionComponent;
|
||||
@@ -102,7 +103,7 @@ describe('SearchFacetOptionComponent', () => {
|
||||
}
|
||||
},
|
||||
{
|
||||
provide: SearchFilterService, useValue: {
|
||||
provide: FILTER_SEARCH, useValue: {
|
||||
getSelectedValuesForFilter: () => selectedValues,
|
||||
isFilterActiveWithValue: (paramName: string, filterValue: string) => observableOf(true),
|
||||
getPage: (paramName: string) => page,
|
||||
|
@@ -23,6 +23,7 @@ import { PaginationComponentOptions } from '../../../../../pagination/pagination
|
||||
import { PaginationService } from '../../../../../../core/pagination/pagination.service';
|
||||
import { PaginationServiceStub } from '../../../../../testing/pagination-service.stub';
|
||||
import { ShortNumberPipe } from '../../../../../utils/short-number.pipe';
|
||||
import { FILTER_SEARCH } from "../../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
describe('SearchFacetRangeOptionComponent', () => {
|
||||
let comp: SearchFacetRangeOptionComponent;
|
||||
@@ -76,7 +77,7 @@ describe('SearchFacetRangeOptionComponent', () => {
|
||||
}
|
||||
},
|
||||
{
|
||||
provide: SearchFilterService, useValue: {
|
||||
provide: FILTER_SEARCH, useValue: {
|
||||
isFilterActiveWithValue: (paramName: string, filterValue: string) => observableOf(true),
|
||||
getPage: (paramName: string) => page,
|
||||
/* eslint-disable no-empty,@typescript-eslint/no-empty-function */
|
||||
|
@@ -17,6 +17,7 @@ import { SearchFacetSelectedOptionComponent } from './search-facet-selected-opti
|
||||
import { PaginationComponentOptions } from '../../../../../pagination/pagination-component-options.model';
|
||||
import { PaginationService } from '../../../../../../core/pagination/pagination.service';
|
||||
import { PaginationServiceStub } from '../../../../../testing/pagination-service.stub';
|
||||
import { FILTER_SEARCH } from "../../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
describe('SearchFacetSelectedOptionComponent', () => {
|
||||
let comp: SearchFacetSelectedOptionComponent;
|
||||
@@ -126,7 +127,7 @@ describe('SearchFacetSelectedOptionComponent', () => {
|
||||
}
|
||||
},
|
||||
{
|
||||
provide: SearchFilterService, useValue: {
|
||||
provide: FILTER_SEARCH, useValue: {
|
||||
getSelectedValuesForFilter: () => selectedValues,
|
||||
isFilterActiveWithValue: (paramName: string, filterValue: string) => observableOf(true),
|
||||
getPage: (paramName: string) => page,
|
||||
|
@@ -24,6 +24,7 @@ import { RemoteDataBuildService } from '../../../../../core/cache/builders/remot
|
||||
import { SearchConfigurationServiceStub } from '../../../../testing/search-configuration-service.stub';
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../../../../my-dspace-page/my-dspace-page.component';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../../remote-data.utils';
|
||||
import { FILTER_SEARCH } from "../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
describe('SearchFacetFilterComponent', () => {
|
||||
let comp: SearchFacetFilterComponent;
|
||||
@@ -100,7 +101,7 @@ describe('SearchFacetFilterComponent', () => {
|
||||
{ provide: IN_PLACE_SEARCH, useValue: false },
|
||||
{ provide: REFRESH_FILTER, useValue: new BehaviorSubject<boolean>(false) },
|
||||
{
|
||||
provide: SearchFilterService, useValue: {
|
||||
provide: FILTER_SEARCH, useValue: {
|
||||
getSelectedValuesForFilter: () => observableOf(selectedValues),
|
||||
isFilterActiveWithValue: (paramName: string, filterValue: string) => true,
|
||||
getPage: (paramName: string) => page,
|
||||
|
@@ -14,6 +14,7 @@ import { SearchConfigurationServiceStub } from '../../../testing/search-configur
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../../../my-dspace-page/my-dspace-page.component';
|
||||
import { SequenceService } from '../../../../core/shared/sequence.service';
|
||||
import { BrowserOnlyMockPipe } from '../../../testing/browser-only-mock.pipe';
|
||||
import { FILTER_SEARCH } from "../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
describe('SearchFilterComponent', () => {
|
||||
let comp: SearchFilterComponent;
|
||||
@@ -70,7 +71,7 @@ describe('SearchFilterComponent', () => {
|
||||
providers: [
|
||||
{ provide: SearchService, useValue: searchServiceStub },
|
||||
{
|
||||
provide: SearchFilterService,
|
||||
provide: FILTER_SEARCH,
|
||||
useValue: mockFilterService
|
||||
},
|
||||
{ provide: SEARCH_CONFIG_SERVICE, useValue: new SearchConfigurationServiceStub() },
|
||||
|
@@ -26,6 +26,7 @@ import { SearchConfigurationServiceStub } from '../../../../testing/search-confi
|
||||
import { VocabularyEntryDetail } from '../../../../../core/submission/vocabularies/models/vocabulary-entry-detail.model';
|
||||
import { FacetValue} from '../../../models/facet-value.model';
|
||||
import { SearchFilterConfig } from '../../../models/search-filter-config.model';
|
||||
import { FILTER_SEARCH } from "../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
describe('SearchHierarchyFilterComponent', () => {
|
||||
|
||||
@@ -67,7 +68,7 @@ describe('SearchHierarchyFilterComponent', () => {
|
||||
],
|
||||
providers: [
|
||||
{ provide: SearchService, useValue: searchService },
|
||||
{ provide: SearchFilterService, useValue: searchFilterService },
|
||||
{ provide: FILTER_SEARCH, useValue: searchFilterService },
|
||||
{ provide: RemoteDataBuildService, useValue: {} },
|
||||
{ provide: Router, useValue: router },
|
||||
{ provide: NgbModal, useValue: ngbModal },
|
||||
|
@@ -25,6 +25,7 @@ import { SEARCH_CONFIG_SERVICE } from '../../../../../my-dspace-page/my-dspace-p
|
||||
import { SearchConfigurationServiceStub } from '../../../../testing/search-configuration-service.stub';
|
||||
import { createSuccessfulRemoteDataObject$ } from '../../../../remote-data.utils';
|
||||
import { RouteService } from '../../../../../core/services/route.service';
|
||||
import { FILTER_SEARCH } from "../../../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
describe('SearchRangeFilterComponent', () => {
|
||||
let comp: SearchRangeFilterComponent;
|
||||
@@ -106,7 +107,7 @@ describe('SearchRangeFilterComponent', () => {
|
||||
{ provide: IN_PLACE_SEARCH, useValue: false },
|
||||
{ provide: REFRESH_FILTER, useValue: new BehaviorSubject<boolean>(false) },
|
||||
{
|
||||
provide: SearchFilterService, useValue: {
|
||||
provide: FILTER_SEARCH, useValue: {
|
||||
getSelectedValuesForFilter: () => selectedValues,
|
||||
isFilterActiveWithValue: (paramName: string, filterValue: string) => true,
|
||||
getPage: (paramName: string) => page,
|
||||
|
@@ -9,6 +9,7 @@ import { SearchFiltersComponent } from './search-filters.component';
|
||||
import { SearchService } from '../../../core/shared/search/search.service';
|
||||
import { SEARCH_CONFIG_SERVICE } from '../../../my-dspace-page/my-dspace-page.component';
|
||||
import { SearchConfigurationServiceStub } from '../../testing/search-configuration-service.stub';
|
||||
import { FILTER_SEARCH } from "../../../admin/admin-notify-dashboard/admin-notify-dashboard.component";
|
||||
|
||||
describe('SearchFiltersComponent', () => {
|
||||
let comp: SearchFiltersComponent;
|
||||
@@ -36,7 +37,7 @@ describe('SearchFiltersComponent', () => {
|
||||
providers: [
|
||||
{ provide: SearchService, useValue: searchServiceStub },
|
||||
{ provide: SEARCH_CONFIG_SERVICE, useValue: new SearchConfigurationServiceStub() },
|
||||
{ provide: SearchFilterService, useValue: searchFiltersStub },
|
||||
{ provide: FILTER_SEARCH, useValue: searchFiltersStub },
|
||||
|
||||
],
|
||||
schemas: [NO_ERRORS_SCHEMA]
|
||||
|
@@ -3509,6 +3509,10 @@
|
||||
|
||||
"search.filters.filter.target.placeholder": "Target",
|
||||
|
||||
"search.filters.filter.origin.label": "Search source",
|
||||
|
||||
"search.filters.filter.origin.placeholder": "Source",
|
||||
|
||||
"search.filters.filter.queue_status.placeholder": "Queue status",
|
||||
|
||||
"search.filters.filter.activity_stream_type.placeholder": "Activity stream type",
|
||||
|
Reference in New Issue
Block a user