Unable to return value for node-cache
chungyau97 opened this issue · comments
Describe the bug
I'm not able to mock node-cache's get function to return a specific value
To Reproduce
Steps to reproduce the behavior:
Below are the functions in cacheService.js:
Below are the unit test in cacheService.test.js
Expected behavior
It should return "exampleData" instead of undefined
Context (please complete the following information):
- Library version:
"node-cache": "^5.1.2"
"chai": "^4.3.7",
"mocha": "^10.2.0",
"nyc": "^15.1.0",
"sinon": "^15.0.1"
We are trying to keep the GitHub issues list tidy and focused on bugs and feature discussions. This ticket looks like a usage question; please post it to StackOverflow and tag it with sinon
, so the bigger community can help answer your questions.
If you feel that your topic is an issue with Sinon, please open a new ticket and follow the guidelines for reporting an issue.
This is a very nice and seemingly easily reproducible test case, so I would suspect that someone should be able to help you very quickly. There seems to always be someone subscribing to the sinon
label on SO, so I think they should be able to help you out
P.S. Feel free to post a comment here with link to the StackOverflow question+answer.