Skip to content

how do I mock error conditions in unit tests? #2443

Answered by mihaitodor
smousa asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @smousa 👋 Sure! You can use mocking and have mapping: 'root = throw("your specific error")'. For example, you could do mapping: 'root = throw("key does not exist")' to simulate a cache miss.

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@smousa
Comment options

@mihaitodor
Comment options

Answer selected by smousa
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants