mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-04-08 19:14:18 +00:00
Tests for default layout component
This commit is contained in:
parent
6853901341
commit
dc22510d30
@ -1,14 +1,35 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { DefaultLayoutComponent } from './default-layout.component';
|
||||
import { ElectronService } from 'ngx-electron';
|
||||
import { MatIconModule, MatMenuModule, MatToolbarModule, MatProgressSpinnerModule } from '@angular/material';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { ProgressComponent } from '../../common/progress/progress.component';
|
||||
import { ProgressService } from '../../common/progress/progress.service';
|
||||
|
||||
|
||||
class ElectronServiceMock {
|
||||
public isElectronApp: boolean;
|
||||
}
|
||||
|
||||
describe('DefaultLayoutComponent', () => {
|
||||
let component: DefaultLayoutComponent;
|
||||
let fixture: ComponentFixture<DefaultLayoutComponent>;
|
||||
let electronServiceMock: ElectronServiceMock;
|
||||
|
||||
beforeEach(async(() => {
|
||||
electronServiceMock = new ElectronServiceMock();
|
||||
|
||||
TestBed.configureTestingModule({
|
||||
declarations: [DefaultLayoutComponent]
|
||||
declarations: [DefaultLayoutComponent, ProgressComponent],
|
||||
imports: [MatIconModule, MatMenuModule, MatToolbarModule, RouterTestingModule, MatProgressSpinnerModule],
|
||||
providers: [
|
||||
{
|
||||
provide: ElectronService,
|
||||
useValue: electronServiceMock
|
||||
},
|
||||
ProgressService
|
||||
]
|
||||
}).compileComponents();
|
||||
}));
|
||||
|
||||
@ -18,7 +39,19 @@ describe('DefaultLayoutComponent', () => {
|
||||
fixture.detectChanges();
|
||||
});
|
||||
|
||||
// it('should create', () => {
|
||||
// expect(component).toBeTruthy();
|
||||
// });
|
||||
it('should create', () => {
|
||||
expect(component).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should installed software be available', () => {
|
||||
electronServiceMock.isElectronApp = true;
|
||||
component.ngOnInit();
|
||||
expect(component.isInstalledSoftwareAvailable).toBeTruthy();
|
||||
});
|
||||
|
||||
it('should installed software be not available', () => {
|
||||
electronServiceMock.isElectronApp = false;
|
||||
component.ngOnInit();
|
||||
expect(component.isInstalledSoftwareAvailable).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
@ -12,7 +12,7 @@ export class DefaultLayoutComponent implements OnInit {
|
||||
|
||||
constructor(
|
||||
private electronService: ElectronService
|
||||
) { }
|
||||
) {}
|
||||
|
||||
ngOnInit() {
|
||||
this.isInstalledSoftwareAvailable = this.electronService.isElectronApp;
|
||||
|
Loading…
x
Reference in New Issue
Block a user