I complete unit test case to confirmations for delete all project

This commit is contained in:
Rajnikant Lodhi 2022-07-19 18:18:46 +05:30
parent 3bbd755d0a
commit 845f1f1ad8
3 changed files with 32 additions and 3 deletions

View File

@ -1,13 +1,42 @@
import { ComponentFixture, TestBed } from '@angular/core/testing';
import { MatCheckboxModule } from '@angular/material/checkbox';
import { MatDialogModule, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { MatIconModule } from '@angular/material/icon';
import { MatMenuModule } from '@angular/material/menu';
import { MatToolbarModule } from '@angular/material/toolbar';
import { MockedProjectService } from '../../../services/project.service.spec';
import { MockedToasterService } from '../../../services/toaster.service.spec';
import { ProjectService } from '../../../services/project.service';
import { ServerService } from '../../../services/server.service';
import { MockedServerService } from '../../../services/server.service.spec';
import { ToasterService } from '../../../services/toaster.service';
import { ConfirmationDeleteAllProjectsComponent } from './confirmation-delete-all-projects.component';
describe('ConfirmationDeleteAllProjectsComponent', () => {
let component: ConfirmationDeleteAllProjectsComponent;
let fixture: ComponentFixture<ConfirmationDeleteAllProjectsComponent>;
let mockedServerService = new MockedServerService();
let mockedImageManagerService = new MockedProjectService()
let mockedToasterService = new MockedToasterService()
beforeEach(async () => {
await TestBed.configureTestingModule({
imports: [
MatIconModule,
MatToolbarModule,
MatMenuModule,
MatCheckboxModule,
MatDialogModule,
],
providers: [
{ provide: ServerService, useValue: mockedServerService },
{ provide: ProjectService, useValue: mockedImageManagerService },
{ provide: MAT_DIALOG_DATA, useValue: {} },
{ provide: MatDialogRef, useValue: {} },
{ provide: ToasterService, useValue: mockedToasterService },
],
declarations: [ ConfirmationDeleteAllProjectsComponent ]
})
.compileComponents();

View File

@ -1,7 +1,7 @@
import { Component, Inject, OnInit } from '@angular/core';
import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog';
import { ProjectService } from '@services/project.service';
import { ToasterService } from '@services/toaster.service';
import { ProjectService } from '../../../services/project.service';
import { ToasterService } from '../../../services/toaster.service';
import { Observable, of } from 'rxjs';
import { catchError } from 'rxjs/operators';

View File

@ -4,7 +4,7 @@ import { MatBottomSheet } from '@angular/material/bottom-sheet';
import { MatDialog } from '@angular/material/dialog';
import { MatSort, MatSortable } from '@angular/material/sort';
import { ActivatedRoute, Router } from '@angular/router';
import { ExportPortableProjectComponent } from '@components/export-portable-project/export-portable-project.component';
import { ExportPortableProjectComponent } from '../../components/export-portable-project/export-portable-project.component';
import { ElectronService } from 'ngx-electron';
import { BehaviorSubject, merge, Observable } from 'rxjs';
import { map } from 'rxjs//operators';