lundi 3 septembre 2018

Cannot get spyOn test to work properly- Angular

I cannot get my test to work for some reason and it keeps throwing the error:

Expected spy on isCurrentStatus to equal false.

The function being called simply assessed whether the passed in variable equals the currently held status property, and returns either true of false. Nothing major...

Test

it('should return true if current status = status passed in', () => {
    const statusSpy = spyOn(component, 'isCurrentStatus');
    component.event = failedEvent;
    component.isCurrentStatus('failed');
    expect(statusSpy).toEqual(true);
  })

component

event: MyEvent;

isCurrentStatus(status: string): boolean {
    return this.event.status === status;
  }

Aucun commentaire:

Enregistrer un commentaire