Given I have method decorator, e.g.
class Service {
@LogCall()
doSomething() {
return 1 + 1;
}
}
Is it possible to mock @LogCall decorator in unit tests, so it won't be applied or applied with mocked logic?
I am looking for generic solution for any typescript decorator, as it is possible to update your decorator to check window.disableLogDecorator flag or something to turn it off during tests, but that's not reusable solution.
Our use case is, of course, much more complex than in example provided - we have @memoizeSelector which is applied to ngrx/store selectors so they're called only when specific state parts are updated. Due to way we mock state in our tests, @memoizeSelector breaks our tests so ideally we'd like disable it.