mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2024-12-23 23:02:22 +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'">
|
||||
<mat-icon aria-label="Delete project">delete</mat-icon>
|
||||
</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>
|
||||
</button>
|
||||
<button mat-icon-button matTooltip="Open project" (click)="open(row)" *ngIf="row.status == 'closed'">
|
||||
|
@ -85,6 +85,28 @@ describe('ProjectsComponent', () => {
|
||||
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', () => {
|
||||
let project: Project;
|
||||
|
||||
|
@ -41,6 +41,10 @@ export class MockedProjectService {
|
||||
delete(server: Server, project_id: string) {
|
||||
return of(project_id);
|
||||
}
|
||||
|
||||
duplicate(server: Server, project_id: string) {
|
||||
return of(project_id);
|
||||
}
|
||||
}
|
||||
|
||||
describe('ProjectService', () => {
|
||||
|
Loading…
Reference in New Issue
Block a user