@yehia2amer/ngx-inline-editor
Version:
Follow me [](https://twitter.com/carlillo) to be notified about new releases.
14 lines (11 loc) • 315 B
text/typescript
export function mockClass<T extends { new (...args: any[]): InstanceType<T> }>(
klass: T,
): InstanceType<T> {
const instance = new klass();
Object.keys(instance)
.filter(prop => typeof instance[prop] === 'function')
.forEach(prop => {
instance[prop] = jest.fn();
});
return instance;
}