Skip to content

Commit

Permalink
table_test unit setup fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ijabbott committed Sep 21, 2023
1 parent 0debc87 commit a35575c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apps/andi/test/unit/andi_web/live/dataset_live_view/table_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ defmodule AndiWeb.DatasetLiveViewTest.TableTest do
use AndiWeb.Test.AuthConnCase.UnitCase
use Placebo
alias Andi.Schemas.User
alias Andi.InputSchemas.MessageErrors

import Phoenix.LiveViewTest

Expand Down Expand Up @@ -45,6 +46,11 @@ defmodule AndiWeb.DatasetLiveViewTest.TableTest do

allow(Andi.Repo.all(any()), return: [dataset_a, dataset_b, dataset_c, dataset_d])

allow(MessageErrors.get_latest_error(dataset_a.id), return: create_message_error(dataset_a.id))
allow(MessageErrors.get_latest_error(dataset_b.id), return: create_message_error(dataset_b.id))
allow(MessageErrors.get_latest_error(dataset_c.id), return: create_message_error(dataset_c.id))
allow(MessageErrors.get_latest_error(dataset_d.id), return: create_message_error(dataset_d.id))

{:ok, view, _} =
get(conn, @url_path)
|> live()
Expand Down Expand Up @@ -165,4 +171,12 @@ defmodule AndiWeb.DatasetLiveViewTest.TableTest do
end)
end)
end

defp create_message_error(dataset_id) do
%{
dataset_id: dataset_id,
has_current_error: false,
last_error_time: DateTime.from_unix!(0)
}
end
end

0 comments on commit a35575c

Please sign in to comment.