Created
October 13, 2017 11:40
-
-
Save euleule/22adeb49a137fdf8ee85b8d459d7f174 to your computer and use it in GitHub Desktop.
Mock.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Creates mock object for classes. | |
*/ | |
export class Mock { | |
/** | |
* | |
* @param {T} classT Class you want to create a mock object for. | |
* @returns {T} jasmin spy of class T | |
*/ | |
public static create<T extends { name: string, prototype: Object }>(classT: T): T { | |
return jasmine.createSpyObj(classT.name, Object.getOwnPropertyNames(classT.prototype)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment