Leon4gr45 commited on
Commit
d9dc5c9
·
verified ·
1 Parent(s): 94de068

Delete test/workers/expire_domain_change_transitions_test.exs with huggingface_hub

Browse files
test/workers/expire_domain_change_transitions_test.exs DELETED
@@ -1,41 +0,0 @@
1
- defmodule Plausible.Workers.ExpireDomainChangeTransitionsTest do
2
- use Plausible.DataCase, async: true
3
- alias Plausible.Workers.ExpireDomainChangeTransitions
4
- alias Plausible.Site
5
- alias Plausible.Sites
6
-
7
- import ExUnit.CaptureLog
8
-
9
- test "doesn't log when there is nothing to do" do
10
- log =
11
- capture_log(fn ->
12
- assert :ok = ExpireDomainChangeTransitions.perform(nil)
13
- end)
14
-
15
- refute log =~ "Expired"
16
- end
17
-
18
- test "expires domains selectively after change and logs the result" do
19
- now = NaiveDateTime.utc_now()
20
- yesterday = now |> NaiveDateTime.add(-60 * 60 * 24, :second)
21
- three_days_ago = now |> NaiveDateTime.add(-60 * 60 * 72, :second)
22
- long_time_ago = now |> NaiveDateTime.add(-60 * 60 * 24 * 365, :second)
23
-
24
- insert(:site) |> Site.Domain.change("site1.example.com")
25
- insert(:site) |> Site.Domain.change("site2.example.com", at: yesterday)
26
- insert(:site) |> Site.Domain.change("site3.example.com", at: three_days_ago)
27
- insert(:site) |> Site.Domain.change("site4.example.com", at: long_time_ago)
28
-
29
- log =
30
- capture_log(fn ->
31
- assert :ok = ExpireDomainChangeTransitions.perform(nil)
32
- end)
33
-
34
- assert log =~ "Expired 2 from the domain change transition period"
35
-
36
- assert Sites.get_by_domain("site1.example.com").domain_changed_from
37
- assert Sites.get_by_domain("site2.example.com").domain_changed_from
38
- refute Sites.get_by_domain("site3.example.com").domain_changed_from
39
- refute Sites.get_by_domain("site4.example.com").domain_changed_from
40
- end
41
- end