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

There is no fallback data, if no 'Given` method provided. #349

Open
AhmedMohamedAllam opened this issue Aug 8, 2023 · 1 comment
Open

Comments

@AhmedMohamedAllam
Copy link

I have a NetworkProtocol, that have request() method
there are some test cases, where the flow can call the network, but I dinidn't provide a Given call in this test.
is there a way to fallback to a default value if no mocks found?
and also it doesn't point to where the mocked data are missing it fails only without any further information.

@AhmedMohamedAllam AhmedMohamedAllam changed the title There is no fallback data, if given didn't find the method mocked. There is no fallback data, if no 'Given` method provided. Aug 8, 2023
@Stannieman
Copy link

Disclaimer: I'm not a maintainer of this project.
But IMO having default return values is a bad idea. The only scenario where the default is used is if the tested code interacts with the mocks in a way the test did not foresee. In that case, how much value is the test adding? If the test did not foresee that a mock is used in a certain way, how can that same test still prove that the tested code works correctly? The (default) return value is usually used for something, something which is probably not covered by the test if a default would be ok for you.

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

No branches or pull requests

2 participants