Created
September 16, 2020 19:18
-
-
Save mrjoelkemp/484fbbfec1e6d59d7a61203a20db8dd0 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
defmodule MyViewTest do | |
use MyAppWeb.ConnCase | |
import Phoenix.LiveViewTest | |
import Mock | |
require MyView | |
require MyDataFetcher | |
test "it renders the fetched data", %{conn: conn} do | |
response = "Hello There" | |
with_mock MyDataFetcher, | |
fetch: fn -> response end do | |
{:ok, view, _html} = live_isolated(conn, MyView) | |
assert render(view) =~ response | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment