forked from hazza/dspace-angular
fix test dependencies
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { AdminNotifyDetailModalComponent } from './admin-notify-detail-modal.component';
|
||||
import { NgbActiveModal } from "@ng-bootstrap/ng-bootstrap";
|
||||
|
||||
describe('AdminNotifyDetailModalComponent', () => {
|
||||
let component: AdminNotifyDetailModalComponent;
|
||||
@@ -8,7 +9,8 @@ describe('AdminNotifyDetailModalComponent', () => {
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ AdminNotifyDetailModalComponent ]
|
||||
declarations: [ AdminNotifyDetailModalComponent ],
|
||||
providers: [NgbActiveModal]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
@@ -2,6 +2,7 @@ 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";
|
||||
|
||||
describe('AdminNotifyLogsComponent', () => {
|
||||
let component: AdminNotifyIncomingComponent;
|
||||
@@ -10,7 +11,8 @@ describe('AdminNotifyLogsComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot()],
|
||||
declarations: [ AdminNotifyIncomingComponent ]
|
||||
declarations: [ AdminNotifyIncomingComponent ],
|
||||
providers: [ActivatedRoute]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
@@ -2,6 +2,7 @@ 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";
|
||||
|
||||
describe('AdminNotifyLogsComponent', () => {
|
||||
let component: AdminNotifyOutgoingComponent;
|
||||
@@ -10,7 +11,8 @@ describe('AdminNotifyLogsComponent', () => {
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
imports: [TranslateModule.forRoot()],
|
||||
declarations: [ AdminNotifyOutgoingComponent ]
|
||||
declarations: [ AdminNotifyOutgoingComponent ],
|
||||
providers: [ActivatedRoute]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
|
@@ -30,7 +30,7 @@
|
||||
<td>
|
||||
<div class="d-flex flex-column">
|
||||
<button class="btn mb-2 btn-dark" (click)="openDetailModal(message)">Detail</button>
|
||||
<button class="btn btn-warning">Reprocess</button>
|
||||
<button *ngIf="message.queueStatusLabel === reprocessStatus" class="btn btn-warning">Reprocess</button>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
@@ -2,7 +2,7 @@ import { Component, OnInit } from '@angular/core';
|
||||
import { AdminNotifySearchResult } from '../models/admin-notify-message-search-result.model';
|
||||
import { ViewMode } from '../../../core/shared/view-mode.model';
|
||||
import { Context } from '../../../core/shared/context.model';
|
||||
import { AdminNotifyMessage } from '../models/admin-notify-message.model';
|
||||
import { AdminNotifyMessage, QueueStatusMap } from '../models/admin-notify-message.model';
|
||||
import {
|
||||
tabulatableObjectsComponent
|
||||
} from '../../../shared/object-collection/shared/tabulatable-objects/tabulatable-objects.decorator';
|
||||
@@ -12,6 +12,7 @@ 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({
|
||||
@@ -21,12 +22,7 @@ import { AdminNotifyDetailModalComponent } from '../admin-notify-detail-modal/ad
|
||||
})
|
||||
export class AdminNotifySearchResultComponent extends TabulatableResultListElementsComponent<PaginatedList<AdminNotifySearchResult>, AdminNotifySearchResult> implements OnInit{
|
||||
public notifyMessages: AdminNotifyMessage[];
|
||||
|
||||
private queueStatusMap = {
|
||||
QUEUE_STATUS_PROCESSED: 'Processed',
|
||||
QUEUE_STATUS_FAILED: 'Failed',
|
||||
QUEUE_STATUS_UNMAPPED_ACTION: 'Unmapped action',
|
||||
};
|
||||
public reprocessStatus = QueueStatusMap.QUEUE_STATUS_QUEUED_FOR_RETRY;
|
||||
|
||||
constructor(private modalService: NgbModal) {
|
||||
super();
|
||||
@@ -36,10 +32,11 @@ 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 => {
|
||||
const indexableObject = object.indexableObject;
|
||||
indexableObject.coarNotifyType = indexableObject.coarNotifyType.split(':')[1];
|
||||
indexableObject.queueStatusLabel = this.queueStatusMap[indexableObject.queueStatusLabel];
|
||||
indexableObject.queueStatusLabel = QueueStatusMap[indexableObject.queueStatusLabel];
|
||||
return indexableObject;
|
||||
});
|
||||
}
|
||||
|
@@ -6,6 +6,15 @@ import { DSpaceObject } from '../../../core/shared/dspace-object.model';
|
||||
import { GenericConstructor } from '../../../core/shared/generic-constructor';
|
||||
import { ListableObject } from '../../../shared/object-collection/shared/listable-object.model';
|
||||
|
||||
export enum QueueStatusMap {
|
||||
QUEUE_STATUS_PROCESSED = 'Processed',
|
||||
QUEUE_STATUS_FAILED = 'Failed',
|
||||
QUEUE_STATUS_UNMAPPED_ACTION = 'Unmapped action',
|
||||
QUEUE_STATUS_QUEUED_FOR_RETRY = 'Queued for retry',
|
||||
QUEUE_STATUS_PROCESSING = 'Processing',
|
||||
QUEUE_STATUS_QUEUED = 'Queued',
|
||||
QUEUE_STATUS_UNTRUSTED = 'Untrusted',
|
||||
};
|
||||
/**
|
||||
* A message that includes admin notify info
|
||||
*/
|
||||
|
@@ -1,19 +1,45 @@
|
||||
import { ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { TabulatableObjectsLoaderComponent } from './tabulatable-objects-loader.component';
|
||||
import { ThemeService } from "../../../theme-support/theme.service";
|
||||
import { provideMockStore } from "@ngrx/store/testing";
|
||||
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";
|
||||
|
||||
describe('TabulatableObjectsComponent', () => {
|
||||
const testType = 'TestType';
|
||||
class TestType extends ListableObject {
|
||||
getRenderTypes(): (string | GenericConstructor<ListableObject>)[] {
|
||||
return [testType];
|
||||
}
|
||||
}
|
||||
|
||||
class TestTypes extends PaginatedList<ListableObject> {
|
||||
page: TestType[]
|
||||
}
|
||||
|
||||
|
||||
describe('TabulatableObjectsLoaderComponent', () => {
|
||||
let component: TabulatableObjectsLoaderComponent;
|
||||
let fixture: ComponentFixture<TabulatableObjectsLoaderComponent>;
|
||||
|
||||
let themeService: ThemeService;
|
||||
|
||||
beforeEach(async () => {
|
||||
await TestBed.configureTestingModule({
|
||||
declarations: [ TabulatableObjectsLoaderComponent ]
|
||||
declarations: [ TabulatableObjectsLoaderComponent ],
|
||||
providers: [
|
||||
provideMockStore({}),
|
||||
{ provide: ThemeService, useValue: themeService },
|
||||
]
|
||||
})
|
||||
.compileComponents();
|
||||
|
||||
fixture = TestBed.createComponent(TabulatableObjectsLoaderComponent);
|
||||
component = fixture.componentInstance;
|
||||
component.objects = new TestTypes();
|
||||
component.context = Context.Search;
|
||||
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();
|
||||
|
@@ -26,8 +26,8 @@
|
||||
</ds-tabulatable-objects-loader>
|
||||
</div>
|
||||
</div>
|
||||
<ds-error *ngIf="objects.hasFailed" message="{{'error.objects' | translate}}"></ds-error>
|
||||
<ds-themed-loading *ngIf="objects.isLoading" message="{{'loading.objects' | translate}}"></ds-themed-loading>
|
||||
<ds-error *ngIf="objects?.hasFailed" message="{{'error.objects' | translate}}"></ds-error>
|
||||
<ds-themed-loading *ngIf="objects?.isLoading" message="{{'loading.objects' | translate}}"></ds-themed-loading>
|
||||
</ds-pagination>
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user