pokemon-couture/test/pokemon_couture_web/live/clothes_tracker_live_test.exs

18 lines
549 B
Elixir
Raw Normal View History

2021-09-22 14:29:29 +02:00
defmodule PokemonCoutureWeb.ClothesTrackerLiveTest do
2021-09-22 14:30:56 +02:00
import Plug.Conn
use PokemonCoutureWeb.ConnCase
import Phoenix.LiveViewTest
2021-09-22 14:29:29 +02:00
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())
2021-09-22 14:30:56 +02:00
{:ok, _view, html} = live(conn, "/tracker")
2021-09-22 14:29:29 +02:00
assert html =~ "Listing Clothes"
end
end