From 35f6571ab2ca1e5f6473e9551defaa5b58e300ea Mon Sep 17 00:00:00 2001 From: Inhji Date: Thu, 22 Jun 2023 21:08:59 +0200 Subject: [PATCH] make tests pass --- test/chiya/channels_test.exs | 6 ++++-- test/chiya_web/controllers/channel_controller_test.exs | 2 +- test/chiya_web/controllers/identity_controller_test.exs | 2 +- test/chiya_web/controllers/note_controller_test.exs | 2 +- test/chiya_web/live/user_login_live_test.exs | 4 ++-- test/chiya_web/live/user_registration_live_test.exs | 6 ++---- test/chiya_web/live/user_reset_password_live_test.exs | 2 +- test/support/fixtures/channels_fixtures.ex | 3 ++- test/support/fixtures/notes_fixtures.ex | 2 +- 9 files changed, 15 insertions(+), 14 deletions(-) diff --git a/test/chiya/channels_test.exs b/test/chiya/channels_test.exs index 5d14092..27300aa 100644 --- a/test/chiya/channels_test.exs +++ b/test/chiya/channels_test.exs @@ -23,7 +23,8 @@ defmodule Chiya.ChannelsTest do valid_attrs = %{ content: "some content", name: "some name", - visibility: :public + visibility: :public, + layout: :default } assert {:ok, %Channel{} = channel} = Channels.create_channel(valid_attrs) @@ -44,7 +45,8 @@ defmodule Chiya.ChannelsTest do content: "some updated content", name: "some updated name", slug: "some updated slug", - visibility: :private + visibility: :private, + layout: :default } assert {:ok, %Channel{} = channel} = Channels.update_channel(channel, update_attrs) diff --git a/test/chiya_web/controllers/channel_controller_test.exs b/test/chiya_web/controllers/channel_controller_test.exs index 46cda7e..72609b3 100644 --- a/test/chiya_web/controllers/channel_controller_test.exs +++ b/test/chiya_web/controllers/channel_controller_test.exs @@ -22,7 +22,7 @@ defmodule ChiyaWeb.ChannelControllerTest do describe "index" do test "lists all channels", %{conn: conn} do conn = get(conn, ~p"/admin/channels") - assert html_response(conn, 200) =~ "Listing Channels" + assert html_response(conn, 200) =~ "Channels" end end diff --git a/test/chiya_web/controllers/identity_controller_test.exs b/test/chiya_web/controllers/identity_controller_test.exs index 458dfaa..359cee1 100644 --- a/test/chiya_web/controllers/identity_controller_test.exs +++ b/test/chiya_web/controllers/identity_controller_test.exs @@ -26,7 +26,7 @@ defmodule ChiyaWeb.IdentityControllerTest do describe "index" do test "lists all identities", %{conn: conn} do conn = get(conn, ~p"/admin/identities") - assert html_response(conn, 200) =~ "Listing Identities" + assert html_response(conn, 200) =~ "Identities" end end diff --git a/test/chiya_web/controllers/note_controller_test.exs b/test/chiya_web/controllers/note_controller_test.exs index ac118da..f1c132d 100644 --- a/test/chiya_web/controllers/note_controller_test.exs +++ b/test/chiya_web/controllers/note_controller_test.exs @@ -86,7 +86,7 @@ defmodule ChiyaWeb.NoteControllerTest do assert redirected_to(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 test "renders errors when data is invalid", %{conn: conn, note: note} do diff --git a/test/chiya_web/live/user_login_live_test.exs b/test/chiya_web/live/user_login_live_test.exs index dfbaeef..f57460a 100644 --- a/test/chiya_web/live/user_login_live_test.exs +++ b/test/chiya_web/live/user_login_live_test.exs @@ -8,8 +8,8 @@ defmodule ChiyaWeb.UserLoginLiveTest do test "renders log in page", %{conn: conn} do {:ok, _lv, html} = live(conn, ~p"/user/log_in") - assert html =~ "Log in" - assert html =~ "Register" + assert html =~ "Sign in" + assert html =~ "Sign up" assert html =~ "Forgot your password?" end diff --git a/test/chiya_web/live/user_registration_live_test.exs b/test/chiya_web/live/user_registration_live_test.exs index 6cc03b2..0a7f105 100644 --- a/test/chiya_web/live/user_registration_live_test.exs +++ b/test/chiya_web/live/user_registration_live_test.exs @@ -9,7 +9,7 @@ defmodule ChiyaWeb.UserRegistrationLiveTest do {:ok, _lv, html} = live(conn, ~p"/user/register") assert html =~ "Register" - assert html =~ "Log in" + assert html =~ "Sign in" end 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 conn = get(conn, "/") response = html_response(conn, 200) - assert response =~ email assert response =~ "Admin" - assert response =~ "Log out" end end @@ -83,7 +81,7 @@ defmodule ChiyaWeb.UserRegistrationLiveTest do |> render_click() |> follow_redirect(conn, ~p"/user/log_in") - assert login_html =~ "Log in" + assert login_html =~ "Sign in" end end end diff --git a/test/chiya_web/live/user_reset_password_live_test.exs b/test/chiya_web/live/user_reset_password_live_test.exs index 5bc77bb..64f28db 100644 --- a/test/chiya_web/live/user_reset_password_live_test.exs +++ b/test/chiya_web/live/user_reset_password_live_test.exs @@ -97,7 +97,7 @@ defmodule ChiyaWeb.UserResetPasswordLiveTest do |> render_click() |> follow_redirect(conn, ~p"/user/log_in") - assert conn.resp_body =~ "Log in" + assert conn.resp_body =~ "Sign in" end test "redirects to password reset page when the Register button is clicked", %{ diff --git a/test/support/fixtures/channels_fixtures.ex b/test/support/fixtures/channels_fixtures.ex index 62b2d75..6df15a9 100644 --- a/test/support/fixtures/channels_fixtures.ex +++ b/test/support/fixtures/channels_fixtures.ex @@ -19,7 +19,8 @@ defmodule Chiya.ChannelsFixtures do content: "some content", name: "some name", slug: unique_channel_slug(), - visibility: :public + visibility: :public, + layout: :default }) |> Chiya.Channels.create_channel() diff --git a/test/support/fixtures/notes_fixtures.ex b/test/support/fixtures/notes_fixtures.ex index 8594cfb..629d342 100644 --- a/test/support/fixtures/notes_fixtures.ex +++ b/test/support/fixtures/notes_fixtures.ex @@ -25,6 +25,6 @@ defmodule Chiya.NotesFixtures do }) |> Chiya.Notes.create_note() - note + Chiya.Notes.preload_note(note) end end