mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-24 15:16:38 +00:00
Unit tests added
This commit is contained in:
parent
af4ef62132
commit
8163b4d709
@ -40,7 +40,7 @@
|
|||||||
<button mat-icon-button matTooltip="Delete project" (click)="delete(row)" *ngIf="row.status == 'closed'">
|
<button mat-icon-button matTooltip="Delete project" (click)="delete(row)" *ngIf="row.status == 'closed'">
|
||||||
<mat-icon aria-label="Delete project">delete</mat-icon>
|
<mat-icon aria-label="Delete project">delete</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button mat-icon-button matTooltip="Duplicate project" (click)="duplicate(row)">
|
<button mat-icon-button matTooltip="Duplicate project" (click)="duplicate(row)" *ngIf="row.status == 'closed'">
|
||||||
<mat-icon aria-label="Duplicate project">filter_2</mat-icon>
|
<mat-icon aria-label="Duplicate project">filter_2</mat-icon>
|
||||||
</button>
|
</button>
|
||||||
<button mat-icon-button matTooltip="Open project" (click)="open(row)" *ngIf="row.status == 'closed'">
|
<button mat-icon-button matTooltip="Open project" (click)="open(row)" *ngIf="row.status == 'closed'">
|
||||||
|
@ -85,6 +85,28 @@ describe('ProjectsComponent', () => {
|
|||||||
expect(mockedProjectService.delete).toHaveBeenCalled();
|
expect(mockedProjectService.delete).toHaveBeenCalled();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
it('should call project service after duplicate action', () => {
|
||||||
|
spyOn(mockedProjectService, 'duplicate').and.returnValue(of());
|
||||||
|
let project = new Project();
|
||||||
|
project.project_id = '1';
|
||||||
|
project.status = 'closed';
|
||||||
|
|
||||||
|
component.duplicate(project);
|
||||||
|
|
||||||
|
expect(mockedProjectService.duplicate).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('should call refresh after duplicate action', () => {
|
||||||
|
spyOn(component, 'refresh');
|
||||||
|
let project = new Project();
|
||||||
|
project.project_id = '1';
|
||||||
|
project.status = 'closed';
|
||||||
|
|
||||||
|
component.duplicate(project);
|
||||||
|
|
||||||
|
expect(component.refresh).toHaveBeenCalled();
|
||||||
|
});
|
||||||
|
|
||||||
describe('ProjectComponent open', () => {
|
describe('ProjectComponent open', () => {
|
||||||
let project: Project;
|
let project: Project;
|
||||||
|
|
||||||
|
@ -41,6 +41,10 @@ export class MockedProjectService {
|
|||||||
delete(server: Server, project_id: string) {
|
delete(server: Server, project_id: string) {
|
||||||
return of(project_id);
|
return of(project_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
duplicate(server: Server, project_id: string) {
|
||||||
|
return of(project_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
describe('ProjectService', () => {
|
describe('ProjectService', () => {
|
||||||
|
Loading…
Reference in New Issue
Block a user