fix tests
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2022-02-19 00:31:17 -05:00
parent a19ec682e6
commit 91288a9ffa
14 changed files with 247 additions and 147 deletions

View File

@ -120,12 +120,13 @@ defmodule Cannery.AmmoTest do
test "list_ammo_groups/0 returns all ammo_groups",
%{ammo_group: ammo_group, current_user: current_user} do
assert Ammo.list_ammo_groups(current_user) == [ammo_group]
assert Ammo.list_ammo_groups(current_user) == [ammo_group] |> Repo.preload(:shot_groups)
end
test "get_ammo_group!/1 returns the ammo_group with given id",
%{ammo_group: ammo_group, current_user: current_user} do
assert Ammo.get_ammo_group!(ammo_group.id, current_user) == ammo_group
assert Ammo.get_ammo_group!(ammo_group.id, current_user) ==
ammo_group |> Repo.preload(:shot_groups)
end
test "create_ammo_group/1 with valid data creates a ammo_group",
@ -167,7 +168,8 @@ defmodule Cannery.AmmoTest do
assert {:error, %Changeset{}} =
Ammo.update_ammo_group(ammo_group, @invalid_attrs, current_user)
assert ammo_group == Ammo.get_ammo_group!(ammo_group.id, current_user)
assert ammo_group |> Repo.preload(:shot_groups) ==
Ammo.get_ammo_group!(ammo_group.id, current_user)
end
test "delete_ammo_group/1 deletes the ammo_group",

View File

@ -33,12 +33,14 @@ defmodule Cannery.ContainersTest do
test "list_containers/1 returns all containers",
%{current_user: current_user, container: container} do
assert Containers.list_containers(current_user) == [container]
assert Containers.list_containers(current_user) ==
[container |> Repo.preload([:ammo_groups, :tags])]
end
test "get_container!/1 returns the container with given id",
%{current_user: current_user, container: container} do
assert Containers.get_container!(container.id, current_user) == container
assert Containers.get_container!(container.id, current_user) ==
container |> Repo.preload([:ammo_groups, :tags])
end
test "create_container/1 with valid data creates a container", %{current_user: current_user} do
@ -73,7 +75,8 @@ defmodule Cannery.ContainersTest do
assert {:error, %Changeset{}} =
Containers.update_container(container, current_user, @invalid_attrs)
assert container == Containers.get_container!(container.id, current_user)
assert container |> Repo.preload([:ammo_groups, :tags]) ==
Containers.get_container!(container.id, current_user)
end
test "delete_container/1 deletes the container",

View File

@ -50,7 +50,7 @@ defmodule CanneryWeb.AmmoGroupLiveTest do
|> follow_redirect(conn, Routes.ammo_group_index_path(conn, :index))
assert html =~ dgettext("prompts", "Ammo group created successfully")
assert html =~ "some notes"
assert html =~ "42"
end
test "saves new shot_group", %{conn: conn, ammo_group: ammo_group} do
@ -95,7 +95,7 @@ defmodule CanneryWeb.AmmoGroupLiveTest do
|> follow_redirect(conn, Routes.ammo_group_index_path(conn, :index))
assert html =~ dgettext("prompts", "Ammo group updated successfully")
assert html =~ "some updated notes"
assert html =~ "43"
end
test "deletes ammo_group in listing", %{conn: conn, ammo_group: ammo_group} do

View File

@ -70,7 +70,7 @@ defmodule CanneryWeb.ContainerLiveTest do
{:ok, index_live, _html} = live(conn, Routes.container_index_path(conn, :index))
assert index_live |> element("[data-qa=\"edit-#{container.id}\"]") |> render_click() =~
gettext("Edit Container")
gettext("Edit %{name}", name: container.name)
assert_patch(index_live, Routes.container_index_path(conn, :edit, container))
@ -103,7 +103,7 @@ defmodule CanneryWeb.ContainerLiveTest do
test "displays container", %{conn: conn, container: container} do
{:ok, _show_live, html} = live(conn, Routes.container_show_path(conn, :show, container))
assert html =~ gettext("Show Container")
assert html =~ gettext("Show %{name}", name: container.name)
assert html =~ container.location
end
@ -115,7 +115,7 @@ defmodule CanneryWeb.ContainerLiveTest do
{:ok, show_live, _html} = live(conn, Routes.container_show_path(conn, :show, container))
assert show_live |> element("[data-qa=\"edit\"]") |> render_click() =~
gettext("Edit Container")
gettext("Edit %{name}", name: container.name)
assert_patch(show_live, Routes.container_show_path(conn, :edit, container))