@@ -5,6 +5,7 @@
55module Network.API.Mandrill.Types where
66
77import Network.API.Mandrill.Utils
8+import Test.QuickCheck
89import Data.Char
910import Data.Time
1011import Control.Applicative
@@ -97,6 +98,8 @@ data MandrillRecipient = MandrillRecipient {
9798makeLenses ''MandrillRecipient
9899deriveJSON defaultOptions { fieldLabelModifier = drop 6 } ''MandrillRecipient
99100
101+instance Arbitrary MandrillRecipient where
102+ arbitrary = pure $ MandrillRecipient "test@example.com" Nothing Nothing
100103
101104--------------------------------------------------------------------------------
102105newtype MandrillHtml = MandrillHtml Blaze.Html
@@ -117,6 +120,8 @@ instance FromJSON MandrillHtml where
117120 parseJSON (String h) = return $ MandrillHtml (Blaze.toHtml h)
118121 parseJSON v = typeMismatch "Expecting a String for MandrillHtml" v
119122
123+instance Arbitrary MandrillHtml where
124+ arbitrary = pure $ mkMandrillHtml "<p><b>FooBar</b></p>"
120125
121126--------------------------------------------------------------------------------
122127-- | The information on the message to send
@@ -138,6 +143,13 @@ data MandrillMessage = MandrillMessage {
138143makeLenses ''MandrillMessage
139144deriveJSON defaultOptions { fieldLabelModifier = drop 6 } ''MandrillMessage
140145
146+instance Arbitrary MandrillMessage where
147+ arbitrary = MandrillMessage <$> arbitrary
148+ <*> pure Nothing
149+ <*> pure "Test Subject"
150+ <*> pure "sender@example.com"
151+ <*> pure Nothing
152+ <*> resize 2 arbitrary
141153
142154--------------------------------------------------------------------------------
143155type MandrillKey = T.Text