fix: worked on CSM-003

This commit is contained in:
2026-05-07 21:49:59 +02:00
parent 92334256cf
commit 723b8c6433
10 changed files with 132 additions and 56 deletions

View File

@@ -214,6 +214,24 @@ defmodule BDS.PostsTest do
refute File.exists?(full_path)
end
test "delete_post removes DB row before cleaning up side effects", %{project: project} do
assert {:ok, post} =
BDS.Posts.create_post(%{
project_id: project.id,
title: "Atomic Delete",
content: "Body"
})
assert {:ok, :deleted} = BDS.Posts.delete_post(post.id)
assert BDS.Repo.get(BDS.Posts.Post, post.id) == nil
assert {:error, :not_found} = BDS.Posts.delete_post(post.id)
end
test "delete_post returns not_found for nonexistent post" do
assert {:error, :not_found} = BDS.Posts.delete_post(Ecto.UUID.generate())
end
test "archive_post transitions draft and published posts to archived", %{project: project} do
assert {:ok, draft_post} =
BDS.Posts.create_post(%{