I have very simple question.
If i have in one service methods like this one
generateObjectBasedOnName(name: string): SomeObject {
if(this.isNameValid(name)) {
const {namePart1, namePart2} = this.getNameParts(name);
const baseObjectOne = this.getBaseObjectOne(namePart1);
const baseObjectTwo = this.getBaseObjectTwo(namePart2);
baseObjectOne.someDataNeededToSetHere = false;
baseObjectTwo.someDataNeededToSetHere = true;
return this.generateSomeObject(baseObjectOne, baseObjectTwo);
}
return null;
}
Should I, in unit tests, fake methods that are used in this method or should I just leave them to execute normally?
Thanks for any answers :)
The purpose of a unit test is to validate that a specific software unit (in your case that's your service class) performs as designed. Therefore...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.