logo

pleroma

My custom branche(s) on git.pleroma.social/pleroma/pleroma git clone https://hacktivis.me/git/pleroma.git
commit: e98579b1da78b47d6848ec55042640e539e44f6c
parent 40953a8f5c299e55b3f186bd6fdebe1bbf6e7401
Author: Tusooa Zhu <tusooa@kazv.moe>
Date:   Sat, 25 Jun 2022 01:17:09 -0400

Verify that formerRepresentation provided in Update is used

Diffstat:

Mtest/pleroma/object/updater_test.exs13++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)

diff --git a/test/pleroma/object/updater_test.exs b/test/pleroma/object/updater_test.exs @@ -52,14 +52,25 @@ defmodule Pleroma.Object.UpdaterTest do date = Pleroma.Web.ActivityPub.Utils.make_date() update_object_data = Updater.make_update_object_data(original_data, new_data, date) + history = update_object_data["formerRepresentations"]["orderedItems"] + + update_object_data = + update_object_data + |> put_in( + ["formerRepresentations", "orderedItems"], + history ++ [Map.put(original_data, "summary", "additional summary")] + ) + |> put_in(["formerRepresentations", "totalItems"], length(history) + 1) + %{ - updated_data: _updated_data, + updated_data: updated_data, updated: updated, used_history_in_new_object?: used_history_in_new_object? } = Updater.make_new_object_data_from_update_object(original_data, update_object_data) assert updated assert used_history_in_new_object? + assert updated_data["formerRepresentations"] == update_object_data["formerRepresentations"] end end end