Leon4gr45 commited on
Commit
f896e5b
·
verified ·
1 Parent(s): ab20547

Delete test/workers/send_check_stats_emails_test.exs with huggingface_hub

Browse files
test/workers/send_check_stats_emails_test.exs DELETED
@@ -1,74 +0,0 @@
1
- defmodule Plausible.Workers.SendCheckStatsEmailsTest do
2
- use Plausible.DataCase, async: true
3
- use Oban.Testing, repo: Plausible.Repo
4
- use Bamboo.Test
5
-
6
- alias Plausible.Workers.SendCheckStatsEmails
7
-
8
- test "does not send an email before a week has passed" do
9
- user = new_user(inserted_at: days_ago(6), last_seen: days_ago(6))
10
- new_site(domain: "test-site.com", owner: user)
11
-
12
- perform_job(SendCheckStatsEmails, %{})
13
-
14
- assert_no_emails_delivered()
15
- end
16
-
17
- test "does not send an email if the user has logged in recently" do
18
- user = new_user(inserted_at: days_ago(9), last_seen: days_ago(6))
19
- new_site(domain: "test-site.com", owner: user)
20
-
21
- perform_job(SendCheckStatsEmails, %{})
22
-
23
- assert_no_emails_delivered()
24
- end
25
-
26
- test "does not send an email if the user has configured a weekly report" do
27
- user = new_user(inserted_at: days_ago(9), last_seen: days_ago(7))
28
- site = new_site(domain: "test-site.com", owner: user)
29
-
30
- populate_stats(site, [build(:pageview)])
31
- insert(:weekly_report, site: site, recipients: ["user@email.com"])
32
-
33
- perform_job(SendCheckStatsEmails, %{})
34
-
35
- assert_no_emails_delivered()
36
- end
37
-
38
- test "sends an email after a week of signup if the user hasn't logged in" do
39
- user = new_user(inserted_at: days_ago(8), last_seen: days_ago(8))
40
- site = new_site(domain: "test-site.com", owner: user)
41
- populate_stats(site, [build(:pageview)])
42
-
43
- perform_job(SendCheckStatsEmails, %{})
44
-
45
- assert_email_delivered_with(
46
- to: [{user.name, user.email}],
47
- subject: "How Plausible is different"
48
- )
49
- end
50
-
51
- test "team members idling will get the email" do
52
- user = new_user(last_seen: NaiveDateTime.utc_now(:second), inserted_at: days_ago(8))
53
- site = new_site(owner: user)
54
- populate_stats(site, [build(:pageview)])
55
-
56
- user2 =
57
- add_member(team_of(user),
58
- user: new_user(inserted_at: days_ago(8), last_seen: days_ago(8)),
59
- role: :editor
60
- )
61
-
62
- perform_job(SendCheckStatsEmails, %{})
63
-
64
- assert_email_delivered_with(
65
- to: [{user2.name, user2.email}],
66
- subject: "How Plausible is different"
67
- )
68
- end
69
-
70
- defp days_ago(days) do
71
- NaiveDateTime.utc_now(:second)
72
- |> NaiveDateTime.shift(day: -days)
73
- end
74
- end