Send event creation and event update notifications in a background task
The event update notification is made unique so that repeated changes only trigger one notificate every 30 minutes Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
19
test/mobilizon/events/utils_test.exs
Normal file
19
test/mobilizon/events/utils_test.exs
Normal file
@@ -0,0 +1,19 @@
|
||||
defmodule Mobilizon.Events.UtilsTest do
|
||||
use Mobilizon.DataCase, async: true
|
||||
|
||||
alias Mobilizon.Events.Utils
|
||||
|
||||
@now ~U[2021-11-19T18:17:00Z]
|
||||
|
||||
describe "calculate_notification_time" do
|
||||
test "when the event begins in less than 30 minutes" do
|
||||
begins_on = ~U[2021-11-19T18:27:00Z]
|
||||
assert @now == Utils.calculate_notification_time(begins_on, now: @now)
|
||||
end
|
||||
|
||||
test "when the event begins in more than 30 minutes" do
|
||||
begins_on = ~U[2021-11-19T18:17:00Z]
|
||||
assert begins_on == Utils.calculate_notification_time(begins_on, now: @now)
|
||||
end
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user