From 27182489a3b990c36cf3265b4d1e93807114db7f Mon Sep 17 00:00:00 2001 From: Alex Date: Thu, 28 Jul 2022 14:36:32 +0200 Subject: [PATCH] Fix all tests --- lib/claper/accounts/user.ex | 2 +- lib/claper/presentations/presentation_file.ex | 2 +- .../presentations/presentation_state.ex | 2 +- .../live/event_live/event_card_component.ex | 8 +- .../live/event_live/form_component.ex | 6 - .../live/event_live/index.html.heex | 2 +- lib/claper_web/live/event_live/join.html.heex | 2 +- test/claper/presentations_test.exs | 4 +- test/claper_web/live/event_live_test.exs | 99 +++++------------ test/claper_web/live/post_live_test.exs | 104 ++---------------- test/claper_web/views/error_view_test.exs | 14 --- test/claper_web/views/layout_view_test.exs | 8 -- test/claper_web/views/page_view_test.exs | 3 - test/support/conn_case.ex | 10 +- test/support/fixtures/accounts_fixtures.ex | 16 +++ test/support/fixtures/events_fixtures.ex | 2 +- test/support/fixtures/posts_fixtures.ex | 4 +- .../fixtures/presentations_fixtures.ex | 9 +- 18 files changed, 77 insertions(+), 220 deletions(-) delete mode 100644 test/claper_web/views/error_view_test.exs delete mode 100644 test/claper_web/views/layout_view_test.exs delete mode 100644 test/claper_web/views/page_view_test.exs diff --git a/lib/claper/accounts/user.ex b/lib/claper/accounts/user.ex index 5a58cd7..e44d489 100644 --- a/lib/claper/accounts/user.ex +++ b/lib/claper/accounts/user.ex @@ -16,7 +16,7 @@ defmodule Claper.Accounts.User do def registration_changeset(user, attrs, _opts \\ []) do user - |> cast(attrs, [:email]) + |> cast(attrs, [:email, :confirmed_at]) |> validate_email() end diff --git a/lib/claper/presentations/presentation_file.ex b/lib/claper/presentations/presentation_file.ex index 805bb58..2d39253 100644 --- a/lib/claper/presentations/presentation_file.ex +++ b/lib/claper/presentations/presentation_file.ex @@ -17,7 +17,7 @@ defmodule Claper.Presentations.PresentationFile do @doc false def changeset(presentation_file, attrs) do presentation_file - |> cast(attrs, [:length, :status, :hash]) + |> cast(attrs, [:length, :status, :hash, :event_id]) |> cast_assoc(:presentation_state) end end diff --git a/lib/claper/presentations/presentation_state.ex b/lib/claper/presentations/presentation_state.ex index 75b8efc..3e97242 100644 --- a/lib/claper/presentations/presentation_state.ex +++ b/lib/claper/presentations/presentation_state.ex @@ -17,7 +17,7 @@ defmodule Claper.Presentations.PresentationState do @doc false def changeset(presentation_state, attrs) do presentation_state - |> cast(attrs, [:position, :chat_visible, :poll_visible, :join_screen_visible, :banned]) + |> cast(attrs, [:position, :chat_visible, :poll_visible, :join_screen_visible, :banned, :presentation_file_id]) |> validate_required([]) end end diff --git a/lib/claper_web/live/event_live/event_card_component.ex b/lib/claper_web/live/event_live/event_card_component.ex index 3ef1f6a..7102412 100644 --- a/lib/claper_web/live/event_live/event_card_component.ex +++ b/lib/claper_web/live/event_live/event_card_component.ex @@ -7,7 +7,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do |> assign_new(:is_leader, fn -> false end) ~H""" -
  • +
  • @@ -39,7 +39,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do <%= @event.code %>

    -
    +
    <%= if NaiveDateTime.compare(@current_time, @event.started_at) == :gt and NaiveDateTime.compare(@current_time, @event.expired_at) == :lt do %>

    @@ -66,7 +66,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do <%= if NaiveDateTime.compare(@current_time, @event.expired_at) == :lt do %> <%= if @event.presentation_file.status == "done" || (@event.presentation_file.status == "fail" && @event.presentation_file.hash) do %>

    -
    +
    <%= gettext "Present/Customize" %> @@ -110,7 +110,7 @@ defmodule ClaperWeb.EventLive.EventCardComponent do <%= if NaiveDateTime.compare(@current_time, @event.expired_at) == :gt do %>
    -
    +
    -
      +
        <% current_time = NaiveDateTime.utc_now() %> <%= for event <- @managed_events do %> <.live_component module={ClaperWeb.EventLive.EventCardComponent} id={"managed-event-#{event.uuid}"} is_leader={true} event={event} current_time={current_time} /> diff --git a/lib/claper_web/live/event_live/join.html.heex b/lib/claper_web/live/event_live/join.html.heex index 1eece33..384b4dd 100644 --- a/lib/claper_web/live/event_live/join.html.heex +++ b/lib/claper_web/live/event_live/join.html.heex @@ -8,7 +8,7 @@
        -
        +