How to stub EntityManager and Connection in TypeORM with Jest
问题 I got an app on NestJS in Typescript using TypeORM and unit-tests written with Jest. I have a function that uses transactions like this: async createMany(users: User[]) { await this.connection.transaction(async manager => { await manager.save(users[0]); await manager.save(users[1]); }); } That's an example from NestJS docs. I do it roughly in the same way via this.connection.transaction but the business-logic is different. The thing is I want to make a unit-test to test this service function.