base for liveview testing done

This commit is contained in:
Lili (Tlapka) 2021-09-22 14:29:29 +02:00
parent fa4ef7ddd0
commit 83325adf09
2 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,17 @@
defmodule PokemonCoutureWeb.ClothesTrackerLiveTest do
# import Plug.Conn
# use PokemonCoutureWeb.ConnCase
# import Phoenix.LiveViewTest
import PokemonCouture.AccountsFixtures
@endpoint PokemonCoutureWeb.Endpoint
test "on not login redirect", %{conn: conn} do
assert {:error, {:redirect, %{to: "/users/log_in"}}} = live(conn, "/tracker")
end
test "logged in user sees page", %{conn: conn} do
conn = conn |> log_in_user(user_fixture())
{:ok, view, html} = live(conn, "/tracker")
assert html =~ "Listing Clothes"
end
end

View File

@ -0,0 +1,7 @@
defmodule PokemonCoutureWeb.ClothesComponentTest do
import Plug.Conn
import Phoenix.ConnTest
import Phoenix.LiveViewTest
import PokemonCouture.AccountsFixtures
@endpoint PokemonCoutureWeb.Endpoint
end