akkoma/test/pleroma/activity/pruner_test.exs
floatingghost db60640c5b Fixing up deletes a bit (#327)
Co-authored-by: FloatingGhost <hannah@coffee-and-dreams.uk>
Reviewed-on: https://akkoma.dev/AkkomaGang/akkoma/pulls/327
2022-12-01 15:00:53 +00:00

28 lines
663 B
Elixir

defmodule Pleroma.Activity.PrunerTest do
use Pleroma.DataCase, async: true
alias Pleroma.Activity
alias Pleroma.Activity.Pruner
import Pleroma.Factory
describe "prune_deletes" do
test "it prunes old delete objects" do
user = insert(:user)
new_delete = insert(:delete_activity, type: "Delete", user: user)
old_delete =
insert(:delete_activity,
type: "Delete",
user: user,
inserted_at: DateTime.utc_now() |> DateTime.add(-31 * 24, :hour)
)
Pruner.prune_deletes()
assert Activity.get_by_id(new_delete.id)
refute Activity.get_by_id(old_delete.id)
end
end
end