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

ApiMockServer adds missing mocks to mock state #26

Closed
skovmand opened this issue May 16, 2019 · 1 comment · Fixed by #27
Closed

ApiMockServer adds missing mocks to mock state #26

skovmand opened this issue May 16, 2019 · 1 comment · Fixed by #27

Comments

@skovmand
Copy link
Contributor

When using the ApiMockServer during testing a problem can occur, when a call is made which is not properly mocked.

For example if during a test we call: ApiClient.get_households() without setting up a mock response first.

The return value will correctly be set to:
{:error, "No mock set for call", get_households, %{query: %{}}}

However the state in the ApiClientMockServer will be updated with the new state for mocks:
{:get_households, %{query: %{}} => nil

This means that all following calls to assert that no mocks remain will fail:
assert ApiMock.remaining_calls() == %{}

The correct behavior is to return the no mock set error, and leave the state unchanged.

@skovmand skovmand added the bug label May 16, 2019
@skovmand
Copy link
Contributor Author

skovmand commented May 16, 2019

TODO:

  • First priority is to make tests that prove that the bug exists.
  • Fix the problem (which will be a refactor of the involved GenServer function).

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

Successfully merging a pull request may close this issue.

1 participant