Closed ahmadferdous closed 2 years ago
I used mock:
with_mock Finch,
build: fn _, _, _, _ -> :ok end,
request: fn _, _ -> {:error, %Mint.TransportError{reason: :timeout}} end do
assert 1 == 1
end
Here is an example where we test request timeouts using Process.sleep/1
https://github.com/sneako/finch/blob/main/test/finch_test.exs#L318
With this method Bypass accepts the connection but waits to send the response.
You can use a short timeout to avoid slowing down your test suite too much.
Hi,
Bypass is an awesome library for integration testing. It helped me uncover a few problems with my implementation that regular unit tests failed to catch (yup, because mocked response was incorrect 😂 ).
I was looking for a way to write an integration test for request timeout scenario. I looked at the documentation and the bypass code but couldn't figure out a way. Does bypass support this? Or is there way a way to do that? Please help.
Thanks.