You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How can I use your package in my test? I'd like to reflect that some methods are called in my unit test, and to be able to use the dataSource from my service, but it's injected in my real service
describe("Update some attr",()=>{it("should update some attr and return a Entity or null",async()=>{consttypeorm=newMockTypeORM()typeorm.onMock(SomeEntity).toReturn(entity,"getOneOrFail")constqueryRunner=dataSource.createQueryRunner()queryRunner.manager.createQueryBuilder()// Call the Serviceconstresult=awaitmyService.updateSomeAttribute(attrId)expect(queryRunner.connect).toHaveBeenCalled()expect(queryRunner.startTransaction).toHaveBeenCalled()expect(queryRunner.commitTransaction).toHaveBeenCalled()expect(queryRunner.release).toHaveBeenCalled()})})
The text was updated successfully, but these errors were encountered:
I haven't tested on Nestjs, but I'll take a look into your example this weekend and then will let you know. Sorry I am overloaded with projects right now. But I'll definitely take a look this weekend.
Hello,
In your documentation, you're assuming that we can access the datasource directly. However, I have a big service like:
Inside, for some methods I'm using transactions like:
How can I use your package in my test? I'd like to reflect that some methods are called in my unit test, and to be able to use the dataSource from my service, but it's injected in my real service
The text was updated successfully, but these errors were encountered: