Skip to content

Commit

Permalink
whupo
Browse files Browse the repository at this point in the history
  • Loading branch information
rsoeldner committed Nov 23, 2023
1 parent b331aa3 commit 0972be3
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions pact-core-tests/Pact/Core/Test/LegacySerialiseTests.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
-- |
{-# LANGUAGE OverloadedStrings #-}

module Pact.Core.Test.LegacySerialiseTests where

import Test.Tasty (TestTree, testGroup)
import Test.Tasty.HUnit (assertBool, testCase)
import Data.Maybe
import Pact.Core.Serialise.LegacyPact
import Pact.Core.Guards
import Data.Text (Text)
import qualified Data.Text.IO as T

tests :: TestTree
tests = testGroup "Legacy Serialisation"
[ testGroup "KeySet"
[ testCase "pred: keys-2" $ assertBool "KeySet decoding failed" (isJust (decodeKeySet "{\"pred\":\"keys-2\",\"keys\":[\"ddd8\",\"ed0\"]}"))
, testCase "pred: keys-all" $ assertBool "KeySet decoding failed" (isJust (decodeKeySet "{\"pred\":\"keys-all\",\"keys\":[\"ddd8\",\"ed0\"]}"))
, testCase "pred: keys-any" $ assertBool "KeySet decoding failed" (isJust (decodeKeySet "{\"pred\":\"keys-any\",\"keys\":[\"ddd8\",\"ed0\"]}"))
, testCase "pred defaults" $ assertBool "KeySet decoding failed" (maybe False (\k -> KeysAll == _ksPredFun k) (decodeKeySet "{\"pred\":\"keys-all\",\"keys\":[\"ddd8\",\"ed0\"]}"))
, testCase "pred invalid" $ assertBool "Accept invalid pred" (isNothing (decodeKeySet "{\"pred\":\"ABC\",\"keys\":[\"ddd8\",\"ed0\"]}"))
]
]

0 comments on commit 0972be3

Please sign in to comment.