make tests pass

This commit is contained in:
Inhji 2023-06-22 21:08:59 +02:00
parent 32cb9f07c8
commit 35f6571ab2
9 changed files with 15 additions and 14 deletions

View file

@ -23,7 +23,8 @@ defmodule Chiya.ChannelsTest do
valid_attrs = %{ valid_attrs = %{
content: "some content", content: "some content",
name: "some name", name: "some name",
visibility: :public visibility: :public,
layout: :default
} }
assert {:ok, %Channel{} = channel} = Channels.create_channel(valid_attrs) assert {:ok, %Channel{} = channel} = Channels.create_channel(valid_attrs)
@ -44,7 +45,8 @@ defmodule Chiya.ChannelsTest do
content: "some updated content", content: "some updated content",
name: "some updated name", name: "some updated name",
slug: "some updated slug", slug: "some updated slug",
visibility: :private visibility: :private,
layout: :default
} }
assert {:ok, %Channel{} = channel} = Channels.update_channel(channel, update_attrs) assert {:ok, %Channel{} = channel} = Channels.update_channel(channel, update_attrs)

View file

@ -22,7 +22,7 @@ defmodule ChiyaWeb.ChannelControllerTest do
describe "index" do describe "index" do
test "lists all channels", %{conn: conn} do test "lists all channels", %{conn: conn} do
conn = get(conn, ~p"/admin/channels") conn = get(conn, ~p"/admin/channels")
assert html_response(conn, 200) =~ "Listing Channels" assert html_response(conn, 200) =~ "Channels"
end end
end end

View file

@ -26,7 +26,7 @@ defmodule ChiyaWeb.IdentityControllerTest do
describe "index" do describe "index" do
test "lists all identities", %{conn: conn} do test "lists all identities", %{conn: conn} do
conn = get(conn, ~p"/admin/identities") conn = get(conn, ~p"/admin/identities")
assert html_response(conn, 200) =~ "Listing Identities" assert html_response(conn, 200) =~ "Identities"
end end
end end

View file

@ -86,7 +86,7 @@ defmodule ChiyaWeb.NoteControllerTest do
assert redirected_to(conn) == ~p"/admin/notes/#{note}" assert redirected_to(conn) == ~p"/admin/notes/#{note}"
conn = get(conn, ~p"/admin/notes/#{note}") conn = get(conn, ~p"/admin/notes/#{note}")
assert html_response(conn, 200) =~ "some updated content" assert html_response(conn, 200) =~ "some updated name"
end end
test "renders errors when data is invalid", %{conn: conn, note: note} do test "renders errors when data is invalid", %{conn: conn, note: note} do

View file

@ -8,8 +8,8 @@ defmodule ChiyaWeb.UserLoginLiveTest do
test "renders log in page", %{conn: conn} do test "renders log in page", %{conn: conn} do
{:ok, _lv, html} = live(conn, ~p"/user/log_in") {:ok, _lv, html} = live(conn, ~p"/user/log_in")
assert html =~ "Log in" assert html =~ "Sign in"
assert html =~ "Register" assert html =~ "Sign up"
assert html =~ "Forgot your password?" assert html =~ "Forgot your password?"
end end

View file

@ -9,7 +9,7 @@ defmodule ChiyaWeb.UserRegistrationLiveTest do
{:ok, _lv, html} = live(conn, ~p"/user/register") {:ok, _lv, html} = live(conn, ~p"/user/register")
assert html =~ "Register" assert html =~ "Register"
assert html =~ "Log in" assert html =~ "Sign in"
end end
test "redirects if already logged in", %{conn: conn} do test "redirects if already logged in", %{conn: conn} do
@ -50,9 +50,7 @@ defmodule ChiyaWeb.UserRegistrationLiveTest do
# Now do a logged in request and assert on the menu # Now do a logged in request and assert on the menu
conn = get(conn, "/") conn = get(conn, "/")
response = html_response(conn, 200) response = html_response(conn, 200)
assert response =~ email
assert response =~ "Admin" assert response =~ "Admin"
assert response =~ "Log out"
end end
end end
@ -83,7 +81,7 @@ defmodule ChiyaWeb.UserRegistrationLiveTest do
|> render_click() |> render_click()
|> follow_redirect(conn, ~p"/user/log_in") |> follow_redirect(conn, ~p"/user/log_in")
assert login_html =~ "Log in" assert login_html =~ "Sign in"
end end
end end
end end

View file

@ -97,7 +97,7 @@ defmodule ChiyaWeb.UserResetPasswordLiveTest do
|> render_click() |> render_click()
|> follow_redirect(conn, ~p"/user/log_in") |> follow_redirect(conn, ~p"/user/log_in")
assert conn.resp_body =~ "Log in" assert conn.resp_body =~ "Sign in"
end end
test "redirects to password reset page when the Register button is clicked", %{ test "redirects to password reset page when the Register button is clicked", %{

View file

@ -19,7 +19,8 @@ defmodule Chiya.ChannelsFixtures do
content: "some content", content: "some content",
name: "some name", name: "some name",
slug: unique_channel_slug(), slug: unique_channel_slug(),
visibility: :public visibility: :public,
layout: :default
}) })
|> Chiya.Channels.create_channel() |> Chiya.Channels.create_channel()

View file

@ -25,6 +25,6 @@ defmodule Chiya.NotesFixtures do
}) })
|> Chiya.Notes.create_note() |> Chiya.Notes.create_note()
note Chiya.Notes.preload_note(note)
end end
end end