Skip to content

Commit 3d3f48a

Browse files
brandonchinn178ysangkok
authored andcommitted
Add tests for getNotificationEmails
1 parent 3a0fad2 commit 3d3f48a

14 files changed

+737
-7
lines changed

hackage-server.cabal

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,17 @@ data-files:
5252
TUF/timestamp.private
5353

5454
extra-source-files:
55+
tests/golden/ReverseDependenciesTest/getNotificationEmails-NotifyNewVersion.golden
56+
tests/golden/ReverseDependenciesTest/getNotificationEmails-NotifyNewRevision.golden
57+
tests/golden/ReverseDependenciesTest/getNotificationEmails-NotifyMaintainerUpdate-MaintainerAdded.golden
58+
tests/golden/ReverseDependenciesTest/getNotificationEmails-NotifyMaintainerUpdate-MaintainerRemoved.golden
59+
tests/golden/ReverseDependenciesTest/getNotificationEmails-NotifyDocsBuild-success.golden
60+
tests/golden/ReverseDependenciesTest/getNotificationEmails-NotifyDocsBuild-failure.golden
61+
tests/golden/ReverseDependenciesTest/getNotificationEmails-NotifyUpdateTags.golden
62+
tests/golden/ReverseDependenciesTest/getNotificationEmails-NotifyDependencyUpdate-Always.golden
63+
tests/golden/ReverseDependenciesTest/getNotificationEmails-NotifyDependencyUpdate-NewIncompatibility.golden
64+
tests/golden/ReverseDependenciesTest/getNotificationEmails-NotifyDependencyUpdate-BoundsOutOfRange.golden
65+
tests/golden/ReverseDependenciesTest/getNotificationEmails-batched.golden
5566
tests/permissions-tarballs/*.tar.gz
5667
tests/unpack-checks/correct-package-0.1.0.0/LICENSE
5768
tests/unpack-checks/correct-package-0.1.0.0/Main.hs
@@ -569,11 +580,16 @@ test-suite ReverseDependenciesTest
569580
build-tool-depends: hackage-server:hackage-server
570581
build-depends:
571582
, tasty ^>= 1.4
583+
, tasty-golden ^>= 2.3
584+
, tasty-hedgehog ^>= 1.4
572585
, tasty-hunit ^>= 0.10
573586
, HUnit ^>= 1.6
574587
, hedgehog ^>= 1.3
575588
, exceptions
576589
, bimap
590+
, mime-mail
591+
, random
592+
, transformers
577593
other-modules: RevDepCommon
578594

579595
benchmark RevDeps

src/Distribution/Server/Features/UserNotify.hs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,19 @@
99
module Distribution.Server.Features.UserNotify (
1010
NotifyData(..),
1111
NotifyPref(..),
12-
NotifyRevisionRange,
12+
NotifyRevisionRange(..),
1313
NotifyTriggerBounds(..),
1414
UserNotifyFeature(..),
1515
defaultNotifyPrefs,
1616
getUserNotificationsOnRelease,
1717
importNotifyPref,
1818
initUserNotifyFeature,
1919
notifyDataToCSV,
20+
21+
-- * getNotificationEmails
22+
Notification(..),
23+
NotifyMaintainerUpdateType(..),
24+
getNotificationEmails,
2025
) where
2126

2227
import Prelude hiding (lookup)
@@ -887,8 +892,10 @@ data Notification
887892
, notifyWatchedPackages :: [PackageId]
888893
-- ^ Packages maintained by user that depend on updated dep
889894
}
895+
deriving (Show)
890896

891897
data NotifyMaintainerUpdateType = MaintainerAdded | MaintainerRemoved
898+
deriving (Show)
892899

893900
-- | Notifications in the same group are batched in the same email.
894901
--

0 commit comments

Comments
 (0)