I have a service in NestJS I'm testing using @nestjs/testing
in Typescript. But one of the methods depends on another, I would like to mock out the dependent method for only one test, so I can't use the ES6 class mocking, as that would override the class I'm testing with a mock.
class UsersService {
findMany(ids) {
return ids.map(id => this.findOne(id));
}
findOne(id) {
return this.httpService.get(id);
}
}
I want to test both methods, but I want to mock findOne
only when I'm testing findMany
.
Thanks in advance.