Fix for unit tests

This commit is contained in:
piotrpekala7 2020-03-18 14:11:43 +01:00
parent 7ca696643f
commit 6a21b88a4a
4 changed files with 7 additions and 7 deletions

View File

@ -58,9 +58,9 @@ describe('ProgressComponent', () => {
});
it('should set error state when error defined', () => {
const error = new Error('test');
const error = {error: 'test'};
progressService.setError(error);
expect(component.error).toEqual(error);
expect(component.error).toEqual(error.error);
});
it('should clear error when changes route', () => {

View File

@ -10,7 +10,7 @@ import { Subscription } from 'rxjs';
})
export class ProgressComponent implements OnInit, OnDestroy {
visible = false;
error: Error;
error: any;
routerSubscription: Subscription;
constructor(private progressService: ProgressService, private router: Router) {}

View File

@ -30,9 +30,9 @@ describe('ProgressService', () => {
});
it('should propagate event on error', () => {
const error = new Error();
const error = {error: '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', () => {

View File

@ -4,10 +4,10 @@ import { BehaviorSubject } from 'rxjs';
export class State {
public visible: boolean;
public error: Error;
public error: any;
public clear: boolean;
constructor(visible: boolean, error?: Error, clear: boolean = false) {
constructor(visible: boolean, error?: any, clear: boolean = false) {
this.visible = visible;
this.error = error;
this.clear = clear;