Skip to content

Commit

Permalink
Add textual encoding roundtrip test for Iso8601Range type.
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanknowles committed Jul 17, 2019
1 parent bb21118 commit 510fd5b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/core/src/Cardano/Wallet/Api/Types.hs
Expand Up @@ -248,7 +248,7 @@ data ApiErrorCode
-- 2020-02-27 and 2019-02-27, in descending order.
data Iso8601Range (name :: Symbol)
= Iso8601Range (Maybe UTCTime) (Maybe UTCTime)
deriving (Generic, Show)
deriving (Eq, Show)

instance KnownSymbol name => ToText (Iso8601Range name) where
toText (Iso8601Range t1 t2) = prefix <> " " <> suffix
Expand Down
5 changes: 5 additions & 0 deletions lib/core/test/unit/Cardano/Wallet/Api/TypesSpec.hs
Expand Up @@ -164,6 +164,8 @@ import Test.QuickCheck.Arbitrary.Generic
( genericArbitrary, genericShrink )
import Test.QuickCheck.Instances.Time
()
import Test.Text.Roundtrip
( textRoundtrip )
import Web.HttpApiData
( FromHttpApiData (..), ToHttpApiData (..) )

Expand Down Expand Up @@ -206,6 +208,9 @@ spec = do
jsonRoundtripAndGolden $ Proxy @(ApiT WalletPassphraseInfo)
jsonRoundtripAndGolden $ Proxy @(ApiT WalletState)

describe "Can perform roundtrip textual encoding & decoding" $ do
textRoundtrip $ Proxy @(Iso8601Range "test-header")

describe "AddressAmount" $ do
it "fromText . toText === pure"
$ property
Expand Down

0 comments on commit 510fd5b

Please sign in to comment.