basic admin endgame view and add

This commit is contained in:
2026-06-22 20:43:09 +02:00
parent e955e40930
commit 006a2ca1c5
82 changed files with 2031 additions and 2 deletions
+61
View File
@@ -0,0 +1,61 @@
defmodule Chesstrainer.TagsTest do
use Chesstrainer.DataCase
alias Chesstrainer.Tags
describe "tags" do
alias Chesstrainer.Tags.Tag
import Chesstrainer.TagsFixtures
@invalid_attrs %{name: nil, category: nil}
test "list_tags/0 returns all tags" do
tag = tag_fixture()
assert Tags.list_tags() == [tag]
end
test "get_tag!/1 returns the tag with given id" do
tag = tag_fixture()
assert Tags.get_tag!(tag.id) == tag
end
test "create_tag/1 with valid data creates a tag" do
valid_attrs = %{name: "some name", category: "some category"}
assert {:ok, %Tag{} = tag} = Tags.create_tag(valid_attrs)
assert tag.name == "some name"
assert tag.category == "some category"
end
test "create_tag/1 with invalid data returns error changeset" do
assert {:error, %Ecto.Changeset{}} = Tags.create_tag(@invalid_attrs)
end
test "update_tag/2 with valid data updates the tag" do
tag = tag_fixture()
update_attrs = %{name: "some updated name", category: "some updated category"}
assert {:ok, %Tag{} = tag} = Tags.update_tag(tag, update_attrs)
assert tag.name == "some updated name"
assert tag.category == "some updated category"
end
test "update_tag/2 with invalid data returns error changeset" do
tag = tag_fixture()
assert {:error, %Ecto.Changeset{}} = Tags.update_tag(tag, @invalid_attrs)
assert tag == Tags.get_tag!(tag.id)
end
test "delete_tag/1 deletes the tag" do
tag = tag_fixture()
assert {:ok, %Tag{}} = Tags.delete_tag(tag)
assert_raise Ecto.NoResultsError, fn -> Tags.get_tag!(tag.id) end
end
test "change_tag/1 returns a tag changeset" do
tag = tag_fixture()
assert %Ecto.Changeset{} = Tags.change_tag(tag)
end
end
end