I'm kind of new in unit testing and trying to make some test with typeorm.
The code I've is this:
public executeTransaction(querys: IQueryTransaction[]) {
return getManager().transaction(async transactionalManager => {
for (const query of querys) {
await transactionalManager.query(query[0], query[1]);
}
});
}
I need to enter the transaction callBack but can't figured out how to do it. I tried to mock getManager and transaction playing with it, but with no results.
I'm using jest, typeorm and nest.
Someone knows how to do this?.
EDIT: Connecting to the database is not an option