Skip to content
This repository has been archived by the owner on Mar 20, 2019. It is now read-only.

Latest commit

 

History

History
20 lines (15 loc) · 523 Bytes

no-assign-spyon.md

File metadata and controls

20 lines (15 loc) · 523 Bytes

Disallow the assignment of a spyOn return value (no-assign-spyon).

It is often more obvious to pass the spy as a property of the object spied upon instead of from a referencing variable.

The following are considered warnings:

var someSpy = spyOn(someObj, 'someMethod');
// Handle someSpy, for example
// expect(someSpy).toHaveBeenCalled();

The following are not warnings:

spyOn(someObj, 'someMethod');
// Handle someObj.someMethod, for example
// expect(someObj.someMethod).toHaveBeenCalled();