create-spy-obj
Create jasmine spy objects magically
Usage
import { createSpyObj } from 'create-spy-obj';
class MyService {
myMethod() {
return 'foo';
}
}
interface MyInterface {
getName(): string;
}
const myServiceSpyObj = createSpyObj<MyService>();
myServiceSpyObj.myMethod.and.returnValue('bar');
const myInterfaceSpyObj = createSpyObj<MyInterface>();
myInterfaceSpyObj.getName.and.returnValue('cool');
const myServiceSpyObj = createSpyObj(MyService);
myServiceSpyObj.myMethod.and.returnValue('bar');
How it works
✨ Proxy magic ✨