mirror of
https://github.com/GNS3/gns3-web-ui.git
synced 2025-06-20 07:33:50 +00:00
Fix for unit tests
This commit is contained in:
@ -58,9 +58,9 @@ describe('ProgressComponent', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should set error state when error defined', () => {
|
it('should set error state when error defined', () => {
|
||||||
const error = new Error('test');
|
const error = {error: 'test'};
|
||||||
progressService.setError(error);
|
progressService.setError(error);
|
||||||
expect(component.error).toEqual(error);
|
expect(component.error).toEqual(error.error);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should clear error when changes route', () => {
|
it('should clear error when changes route', () => {
|
||||||
|
@ -10,7 +10,7 @@ import { Subscription } from 'rxjs';
|
|||||||
})
|
})
|
||||||
export class ProgressComponent implements OnInit, OnDestroy {
|
export class ProgressComponent implements OnInit, OnDestroy {
|
||||||
visible = false;
|
visible = false;
|
||||||
error: Error;
|
error: any;
|
||||||
routerSubscription: Subscription;
|
routerSubscription: Subscription;
|
||||||
|
|
||||||
constructor(private progressService: ProgressService, private router: Router) {}
|
constructor(private progressService: ProgressService, private router: Router) {}
|
||||||
|
@ -30,9 +30,9 @@ describe('ProgressService', () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it('should propagate event on error', () => {
|
it('should propagate event on error', () => {
|
||||||
const error = new Error();
|
const error = {error: 'Error'};
|
||||||
progressService.setError(error);
|
progressService.setError(error);
|
||||||
expect(progressService.state.next).toHaveBeenCalledWith(new State(false, error));
|
expect(progressService.state.next).toHaveBeenCalledWith(new State(false, error.error));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should clear an error', () => {
|
it('should clear an error', () => {
|
||||||
|
@ -4,10 +4,10 @@ import { BehaviorSubject } from 'rxjs';
|
|||||||
|
|
||||||
export class State {
|
export class State {
|
||||||
public visible: boolean;
|
public visible: boolean;
|
||||||
public error: Error;
|
public error: any;
|
||||||
public clear: boolean;
|
public clear: boolean;
|
||||||
|
|
||||||
constructor(visible: boolean, error?: Error, clear: boolean = false) {
|
constructor(visible: boolean, error?: any, clear: boolean = false) {
|
||||||
this.visible = visible;
|
this.visible = visible;
|
||||||
this.error = error;
|
this.error = error;
|
||||||
this.clear = clear;
|
this.clear = clear;
|
||||||
|
Reference in New Issue
Block a user