@@ -6,7 +6,7 @@ import { ComponentFixture, TestBed } from '@angular/core/testing';
66
77import { WorkspaceItemsDeletePageComponent } from './workspaceitems-delete-page.component' ;
88import { ActivatedRoute , Router } from '@angular/router' ;
9- import { NgbModal } from '@ng-bootstrap/ng-bootstrap' ;
9+ import { NgbModalModule } from '@ng-bootstrap/ng-bootstrap' ;
1010import { TranslateModule , TranslateService } from '@ngx-translate/core' ;
1111import { NotificationsServiceStub } from '../../shared/testing/notifications-service.stub' ;
1212import { EventEmitter , NO_ERRORS_SCHEMA } from '@angular/core' ;
@@ -40,13 +40,12 @@ describe('WorkspaceitemsDeletePageComponent', () => {
4040 onDefaultLangChange : new EventEmitter ( )
4141 } ;
4242
43- const modalService = {
44- open : ( ) => { /** empty */ } ,
45- } ;
46-
4743 beforeEach ( async ( ) => {
4844 await TestBed . configureTestingModule ( {
49- imports : [ TranslateModule . forRoot ( ) ] ,
45+ imports : [
46+ NgbModalModule ,
47+ TranslateModule . forRoot ( )
48+ ] ,
5049 declarations : [ WorkspaceItemsDeletePageComponent ] ,
5150 providers : [
5251 {
@@ -65,7 +64,6 @@ describe('WorkspaceitemsDeletePageComponent', () => {
6564 useValue : workspaceitemDataServiceSpy ,
6665 } ,
6766 { provide : Location , useValue : new LocationStub ( ) } ,
68- { provide : NgbModal , useValue : modalService } ,
6967 {
7068 provide : NotificationsService ,
7169 useValue : new NotificationsServiceStub ( ) ,
@@ -94,7 +92,7 @@ describe('WorkspaceitemsDeletePageComponent', () => {
9492 } ) ;
9593
9694 it ( 'should delete the target workspace item' , ( ) => {
97- spyOn ( ( component as any ) . modalService , 'open' ) . and . returnValue ( { } ) ;
95+ spyOn ( ( component as any ) . modalService , 'open' ) . and . returnValue ( { result : Promise . resolve ( 'ok' ) } ) ;
9896 component . confirmDelete ( By . css ( '#delete-modal' ) ) ;
9997 fixture . detectChanges ( ) ;
10098 expect ( ( component as any ) . modalService . open ) . toHaveBeenCalled ( ) ;
0 commit comments