PickwickSoft / innovedu

Prefer that unbound methods are called with their expected scope JS-0387
Anti-pattern
Major
2 years ago2 years old
Avoid referencing unbound methods which may cause unintentional scoping of this. If your function does not access this, you can annotate it with this: void, or consider using an arrow function instead
 90      saveSubject.complete();
 91
 92      // THEN
 93      expect(topicService.create).toHaveBeenCalledWith(topic); 94      expect(comp.isSaving).toEqual(false);
 95      expect(comp.previousState).toHaveBeenCalled();
 96    });
Avoid referencing unbound methods which may cause unintentional scoping of this. If your function does not access this, you can annotate it with this: void, or consider using an arrow function instead
 92      // THEN
 93      expect(topicService.create).toHaveBeenCalledWith(topic);
 94      expect(comp.isSaving).toEqual(false);
 95      expect(comp.previousState).toHaveBeenCalled(); 96    });
 97
 98    it('Should set isSaving to false on error', () => {
Avoid referencing unbound methods which may cause unintentional scoping of this. If your function does not access this, you can annotate it with this: void, or consider using an arrow function instead
112      // THEN
113      expect(topicService.update).toHaveBeenCalledWith(topic);
114      expect(comp.isSaving).toEqual(false);
115      expect(comp.previousState).not.toHaveBeenCalled();116    });
117  });
118});
Avoid referencing unbound methods which may cause unintentional scoping of this. If your function does not access this, you can annotate it with this: void, or consider using an arrow function instead
 70
 71      // THEN
 72      expect(comp.previousState).toHaveBeenCalled();
 73      expect(topicService.update).toHaveBeenCalledWith(topic); 74      expect(comp.isSaving).toEqual(false);
 75    });
 76
Avoid referencing unbound methods which may cause unintentional scoping of this. If your function does not access this, you can annotate it with this: void, or consider using an arrow function instead
 69      saveSubject.complete();
 70
 71      // THEN
 72      expect(comp.previousState).toHaveBeenCalled(); 73      expect(topicService.update).toHaveBeenCalledWith(topic);
 74      expect(comp.isSaving).toEqual(false);
 75    });