Answer the question
In order to leave comments, you need to log in
How to solve multiple testing questions in NestJS?
Hello everyone, I'm trying to write the first tests in my life now)
Many questions have arisen from this:
1) I have a large service that interacts directly with repositories from other components.
Is it ok? if not, what is the best way?
2) When I wanted to write a unit test for one large method in this service, I ran into the problem of mocking repositories. I have specific queries like:
await this.otherComponentRepository.findOne({
where: { message: Raw((alias) => `${alias} ILIKE '${code}'`) },
lock: { mode: 'pessimistic_write' }
})
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question