From e6ceea35534100f54eebfbbf8167ebcdf557bdb8 Mon Sep 17 00:00:00 2001 From: ilja Date: Sun, 23 Oct 2022 12:33:31 +0200 Subject: [PATCH] fix flaky participation_test.exs It was tested if the updated_at after marking as "read" was equal as the updated_at at insertion, but that seems wrong. Firstly, if a record is updated, you expect the updated_at to also update. Secondly, the insert and update happen almost at the same time, so it's flaky regardless. Here I make sure it has a much older updated_at during insert so we can clealy see the effect after update. I also check that the updated_at is actually updated because I expect that this is the expected behaviour and it's also the current behaviour. --- test/pleroma/conversation/participation_test.exs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/pleroma/conversation/participation_test.exs b/test/pleroma/conversation/participation_test.exs index a25e17c95..2bf57f539 100644 --- a/test/pleroma/conversation/participation_test.exs +++ b/test/pleroma/conversation/participation_test.exs @@ -122,11 +122,11 @@ test "recreating an existing participations sets it to unread" do end test "it marks a participation as read" do - participation = insert(:participation, %{read: false}) + participation = insert(:participation, %{updated_at: ~N[2017-07-17 17:09:58], read: false}) {:ok, updated_participation} = Participation.mark_as_read(participation) assert updated_participation.read - assert updated_participation.updated_at == participation.updated_at + assert :gt = NaiveDateTime.compare(updated_participation.updated_at, participation.updated_at) end test "it marks a participation as unread" do