odavid/typeorm-transactional-cls-hooked

How to test that method uses Transactional decorator?

Closed this issue · 1 comments

boy51 commented

Hi,

thanks for this awesome lib!

is there a way to verify in jest that a method is decorated with @Transactional()?

@Transactional()
something() {
 // ...
}
it("runs in a transaction", () => {
 // ???
})

Any help is much appreciated :-)

Thanks @boy51...
I am not sure about it...

If mocking is what you try to achieve, then you can mock it like mentioned here: https://github.com/odavid/typeorm-transactional-cls-hooked#unit-test-mocking

If you are trying to get decorator metadata, I believe reflect-metadata is the place to search for answers (Haven't used it yet, so not an expert ;)