mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-22 16:39:00 +00:00
Apply code style
This commit is contained in:
@ -1,12 +1,11 @@
|
||||
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
|
||||
|
||||
import { ProgressComponent } from './progress.component';
|
||||
import { MatIconModule, MatProgressSpinnerModule } from "@angular/material";
|
||||
import { ProgressService } from "./progress.service";
|
||||
import { RouterTestingModule } from "@angular/router/testing";
|
||||
import { Router } from "@angular/router";
|
||||
import { BehaviorSubject } from "rxjs";
|
||||
|
||||
import { MatIconModule, MatProgressSpinnerModule } from '@angular/material';
|
||||
import { ProgressService } from './progress.service';
|
||||
import { RouterTestingModule } from '@angular/router/testing';
|
||||
import { Router } from '@angular/router';
|
||||
import { BehaviorSubject } from 'rxjs';
|
||||
|
||||
class MockedRouter {
|
||||
events: BehaviorSubject<boolean>;
|
||||
@ -16,7 +15,6 @@ class MockedRouter {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
describe('ProgressComponent', () => {
|
||||
let component: ProgressComponent;
|
||||
let fixture: ComponentFixture<ProgressComponent>;
|
||||
@ -25,18 +23,10 @@ describe('ProgressComponent', () => {
|
||||
|
||||
beforeEach(async(() => {
|
||||
TestBed.configureTestingModule({
|
||||
imports: [
|
||||
RouterTestingModule,
|
||||
MatProgressSpinnerModule,
|
||||
MatIconModule
|
||||
],
|
||||
providers: [
|
||||
ProgressService,
|
||||
{ provide: Router, useClass: MockedRouter}
|
||||
],
|
||||
declarations: [ ProgressComponent ]
|
||||
})
|
||||
.compileComponents();
|
||||
imports: [RouterTestingModule, MatProgressSpinnerModule, MatIconModule],
|
||||
providers: [ProgressService, { provide: Router, useClass: MockedRouter }],
|
||||
declarations: [ProgressComponent]
|
||||
}).compileComponents();
|
||||
|
||||
progressService = TestBed.get(ProgressService);
|
||||
router = TestBed.get(Router);
|
||||
@ -53,26 +43,26 @@ describe('ProgressComponent', () => {
|
||||
expect(component.visible).toEqual(false);
|
||||
});
|
||||
|
||||
it( 'should change visibility when activated', () => {
|
||||
it('should change visibility when activated', () => {
|
||||
progressService.activate();
|
||||
expect(component.visible).toEqual(true);
|
||||
});
|
||||
|
||||
it( 'should change visibility when deactivated', () => {
|
||||
it('should change visibility when deactivated', () => {
|
||||
component.visible = true;
|
||||
|
||||
progressService.deactivate();
|
||||
expect(component.visible).toEqual(false);
|
||||
});
|
||||
|
||||
it( 'should set error state when error defined', () => {
|
||||
const error = new Error("test");
|
||||
it('should set error state when error defined', () => {
|
||||
const error = new Error('test');
|
||||
progressService.setError(error);
|
||||
expect(component.error).toEqual(error);
|
||||
});
|
||||
|
||||
it( 'should clear error when changes route', () => {
|
||||
const error = new Error("test");
|
||||
it('should clear error when changes route', () => {
|
||||
const error = new Error('test');
|
||||
component.error = error;
|
||||
|
||||
spyOn(progressService, 'clear');
|
||||
@ -81,5 +71,4 @@ describe('ProgressComponent', () => {
|
||||
|
||||
expect(progressService.clear).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
});
|
||||
|
Reference in New Issue
Block a user