add length limits to all items

This commit is contained in:
2023-03-19 23:46:42 -04:00
parent e5e5449e8b
commit fe4e4f4f17
41 changed files with 473 additions and 399 deletions

View File

@ -28,14 +28,14 @@ defmodule Cannery.ContainersTest do
"type" => nil
}
@valid_tag_attrs %{
"bg_color" => "some bg-color",
"bg_color" => "#100000",
"name" => "some name",
"text_color" => "some text-color"
"text_color" => "#000000"
}
@update_tag_attrs %{
"bg_color" => "some updated bg-color",
"bg_color" => "#100001",
"name" => "some updated name",
"text_color" => "some updated text-color"
"text_color" => "#000001"
}
@invalid_tag_attrs %{
"bg_color" => nil,
@ -186,9 +186,9 @@ defmodule Cannery.ContainersTest do
test "create_tag/2 with valid data creates a tag", %{current_user: current_user} do
assert {:ok, %Tag{} = tag} = Containers.create_tag(@valid_tag_attrs, current_user)
assert tag.bg_color == "some bg-color"
assert tag.bg_color == "#100000"
assert tag.name == "some name"
assert tag.text_color == "some text-color"
assert tag.text_color == "#000000"
end
test "create_tag/2 with invalid data returns error changeset",
@ -198,9 +198,9 @@ defmodule Cannery.ContainersTest do
test "update_tag/3 with valid data updates the tag", %{tag: tag, current_user: current_user} do
assert {:ok, %Tag{} = tag} = Containers.update_tag(tag, @update_tag_attrs, current_user)
assert tag.bg_color == "some updated bg-color"
assert tag.bg_color == "#100001"
assert tag.name == "some updated name"
assert tag.text_color == "some updated text-color"
assert tag.text_color == "#000001"
end
test "update_tag/3 with invalid data returns error changeset",

View File

@ -10,14 +10,14 @@ defmodule CanneryWeb.TagLiveTest do
@moduletag :tag_live_test
@create_attrs %{
"bg_color" => "some bg-color",
"bg_color" => "#100000",
"name" => "some name",
"text_color" => "some text-color"
"text_color" => "#000000"
}
@update_attrs %{
"bg_color" => "some updated bg-color",
"bg_color" => "#100001",
"name" => "some updated name",
"text_color" => "some updated text-color"
"text_color" => "#000001"
}
# @invalid_attrs %{
@ -86,7 +86,7 @@ defmodule CanneryWeb.TagLiveTest do
|> follow_redirect(conn, Routes.tag_index_path(conn, :index))
assert html =~ dgettext("actions", "%{name} created successfully", name: "some name")
assert html =~ "some bg-color"
assert html =~ "#100000"
end
test "updates tag in listing", %{conn: conn, tag: tag} do
@ -110,7 +110,7 @@ defmodule CanneryWeb.TagLiveTest do
assert html =~
dgettext("prompts", "%{name} updated successfully", name: "some updated name")
assert html =~ "some updated bg-color"
assert html =~ "#100001"
end
test "deletes tag in listing", %{conn: conn, tag: tag} do

View File

@ -149,9 +149,9 @@ defmodule Cannery.Fixtures do
def tag_fixture(attrs \\ %{}, %User{} = user) do
attrs
|> Enum.into(%{
"bg_color" => "some bg-color",
"bg_color" => "#100000",
"name" => "some name",
"text_color" => "some text-color"
"text_color" => "#000000"
})
|> Containers.create_tag(user)
|> unwrap_ok_tuple()