Merge remote-tracking branch '4sciencebitbucket/DURACOM-133' into DURACOM-133

This commit is contained in:
Giuseppe Digilio
2023-05-19 18:33:20 +02:00
2 changed files with 9 additions and 10 deletions

View File

@@ -194,8 +194,9 @@ describe('CommunityListComponent', () => {
}, },
}), }),
CdkTreeModule, CdkTreeModule,
RouterTestingModule], RouterTestingModule,
declarations: [CommunityListComponent, RouterLinkWithHref], RouterLinkWithHref],
declarations: [CommunityListComponent],
providers: [CommunityListComponent, providers: [CommunityListComponent,
{ provide: CommunityListService, useValue: communityListServiceStub },], { provide: CommunityListService, useValue: communityListServiceStub },],
schemas: [CUSTOM_ELEMENTS_SCHEMA], schemas: [CUSTOM_ELEMENTS_SCHEMA],

View File

@@ -6,7 +6,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
import { WorkspaceItemsDeletePageComponent } from './workspaceitems-delete-page.component'; import { WorkspaceItemsDeletePageComponent } from './workspaceitems-delete-page.component';
import { ActivatedRoute, Router } from '@angular/router'; import { ActivatedRoute, Router } from '@angular/router';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'; import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
import { TranslateModule, TranslateService } from '@ngx-translate/core'; import { TranslateModule, TranslateService } from '@ngx-translate/core';
import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub'; import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub';
import { EventEmitter, NO_ERRORS_SCHEMA } from '@angular/core'; import { EventEmitter, NO_ERRORS_SCHEMA } from '@angular/core';
@@ -40,13 +40,12 @@ describe('WorkspaceitemsDeletePageComponent', () => {
onDefaultLangChange: new EventEmitter() onDefaultLangChange: new EventEmitter()
}; };
const modalService = {
open: () => {/** empty */},
};
beforeEach(async () => { beforeEach(async () => {
await TestBed.configureTestingModule({ await TestBed.configureTestingModule({
imports: [TranslateModule.forRoot()], imports: [
NgbModalModule,
TranslateModule.forRoot()
],
declarations: [WorkspaceItemsDeletePageComponent], declarations: [WorkspaceItemsDeletePageComponent],
providers: [ providers: [
{ {
@@ -65,7 +64,6 @@ describe('WorkspaceitemsDeletePageComponent', () => {
useValue: workspaceitemDataServiceSpy, useValue: workspaceitemDataServiceSpy,
}, },
{ provide: Location, useValue: new LocationStub() }, { provide: Location, useValue: new LocationStub() },
{ provide: NgbModal, useValue: modalService },
{ {
provide: NotificationsService, provide: NotificationsService,
useValue: new NotificationsServiceStub(), useValue: new NotificationsServiceStub(),
@@ -94,7 +92,7 @@ describe('WorkspaceitemsDeletePageComponent', () => {
}); });
it('should delete the target workspace item', () => { it('should delete the target workspace item', () => {
spyOn((component as any).modalService, 'open').and.returnValue({}); spyOn((component as any).modalService, 'open').and.returnValue({result: Promise.resolve('ok')});
component.confirmDelete(By.css('#delete-modal')); component.confirmDelete(By.css('#delete-modal'));
fixture.detectChanges(); fixture.detectChanges();
expect((component as any).modalService.open).toHaveBeenCalled(); expect((component as any).modalService.open).toHaveBeenCalled();