Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to mock/stub/change CacheModule.store option for a test app ? #681

Closed
ruscon opened this issue Sep 18, 2019 · 3 comments
Closed

How to mock/stub/change CacheModule.store option for a test app ? #681

ruscon opened this issue Sep 18, 2019 · 3 comments

Comments

@ruscon
Copy link

ruscon commented Sep 18, 2019

I'm submitting a...


[ ] Regression 
[ ] Bug report
[ ] Feature request
[ x ] Documentation issue or request (new chapter/page)
[ ] Support request => Please do not submit support request here, instead post your question on Stack Overflow.

Current behavior

I didn't find any documentation how to write tests for CacheModule or change store option

Expected behavior

For example, we are using CacheModule with Redis in production.
In the test app, we want to use CacheModule with memory.

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Environment


For Tooling issues:
- Node version: any  
- Platform: any 
- NestJS: 6.7.1
@ruscon ruscon changed the title How to mock/stub/change CacheModule.store for test app ? How to mock/stub/change CacheModule.store option for test app ? Sep 18, 2019
@ruscon ruscon changed the title How to mock/stub/change CacheModule.store option for test app ? How to mock/stub/change CacheModule.store option for a test app ? Sep 18, 2019
@micalevisk
Copy link
Member

  .overrideProvider(CACHE_MODULE_OPTIONS) // exported from @nestjs/common
  .useValue(newCacheModuleOptions)

might help you.

@binarytracer
Copy link

@micalevisk on nest info as this
[Nest CLI]
Nest CLI Version : 9.0.0

[Nest Platform Information]
platform-socket.io version : 9.0.11
platform-express version : 9.0.11
mapped-types version : 1.1.0
websockets version : 9.0.11
schematics version : 9.0.1
swagger version : 6.0.5
testing version : 9.0.11
common version : 9.0.11
config version : 2.2.0
axios version : 0.1.0
core version : 9.0.11
cli version : 9.0.0

CACHE_MODULE_OPTIONS is not accessible anymore from @nestjs/common

@micalevisk
Copy link
Member

@binarytracer that will be fixed by nestjs/nest#10143

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants