Verify that formerRepresentation provided in Update is used

This commit is contained in:
Tusooa Zhu 2022-06-25 01:17:09 -04:00
parent 40953a8f5c
commit e98579b1da
No known key found for this signature in database
GPG Key ID: 7B467EDE43A08224
1 changed files with 12 additions and 1 deletions

View File

@ -52,14 +52,25 @@ test "it reuses formerRepresentations if it exists" 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