utils-decorators
utils-decorators copied to clipboard
Disable Caching for test envs
I'm using @memoizeAsync , and it tends screw up my unit tests , as the result of one test is being cached and returned in another test.
I want a simple way to disable caching globally in order to avoid this.
@Nemo9439 any suggestions?
@Nemo9439 any suggestions?
@vlio20 I'm testing a branch with a global configuration object, so we can modify the settings at a global level. EX:
Config.Global.disableCache = true;
I want your opinion on this
@tripodsgames, I would like to avoid that because of the different configuration options that the different decorators have. Any other suggestions?
@tripodsgames, I would like to avoid that because of the different configuration options that the different decorators have. Any other suggestions?
And a base configuration per decorator? EX:
memoizeAsync.DefaultSettings.disableCache = true;
It would even be useful to configure a default configuration. EX:
memoizeAsync.DefaultSettings.expirationTimeMs = 10000;
I think it would be better to have such configuration on the app level and not inside the lib. As there are multiple ways in which you could provide the configuration to the different decorators.
As more as I am thinking about a global configuration the less I want it to be part of the lib.
This issue is already old, maybe it should be closed. But anyway, my suggestion to @Nemo9439 is to write a wrapper decorator which does what he needs. I did something similar in this stackblitz