Skip to content

Commit

Permalink
add properties for submissions store via API-operations
Browse files Browse the repository at this point in the history
  • Loading branch information
paolino committed Nov 29, 2022
1 parent 3030387 commit 4fc8051
Showing 1 changed file with 31 additions and 10 deletions.
Expand Up @@ -15,10 +15,14 @@ import Cardano.Wallet.Api.TypesSpec
()
import Cardano.Wallet.DB.Fixtures
( WalletProperty, logScale, withDBInMemory, withInitializedWalletProp )
import Cardano.Wallet.DB.Store.Submissions.New.Operations
( Operation' )
import Cardano.Wallet.DB.Store.Submissions.New.Primitives
( Primitive', mkStorePrimitivesSubmissions )
( Primitive', mkStoreAnySubmissions )
import Cardano.Wallet.Primitive.Types
( SlotNo (..) )
import Cardano.Wallet.Submissions.OperationsSpec
( operationsDeltaG )
import Cardano.Wallet.Submissions.PrimitivesSpec
( primitiveDeltaG )
import Cardano.Wallet.Submissions.Submissions
Expand All @@ -39,18 +43,35 @@ import Test.QuickCheck
spec :: Spec
spec = do
around (withDBInMemory ForeignKeysDisabled) $ do
describe "submissions for a single wallet store" $ do
it "respects store laws" $ property . prop_SingleWalletStoreLaws
describe "submissions via primitives for a single wallet store" $ do
it "respects store laws"
$ property . prop_SingleWalletStoreLawsPrimitives
describe "submissions via API for a single wallet store" $ do
it "respects store laws"
$ property . prop_SingleWalletStoreLawsOperations

instance Buildable Primitive' where
build = build . show

prop_SingleWalletStoreLaws :: WalletProperty
prop_SingleWalletStoreLaws = withInitializedWalletProp $ \wid runQ -> do
void $ prop_StoreUpdates
runQ
(mkStorePrimitivesSubmissions wid)
(pure $ Submissions mempty 0 0)
(logScale . primitiveDeltaG)
instance Buildable Operation' where
build = build . show

deriving instance Random SlotNo

prop_SingleWalletStoreLawsPrimitives :: WalletProperty
prop_SingleWalletStoreLawsPrimitives = withInitializedWalletProp
$ \wid runQ -> do
void $ prop_StoreUpdates
runQ
(mkStoreAnySubmissions wid)
(pure $ Submissions mempty 0 0)
(logScale . primitiveDeltaG)

prop_SingleWalletStoreLawsOperations :: WalletProperty
prop_SingleWalletStoreLawsOperations = withInitializedWalletProp
$ \wid runQ -> do
void $ prop_StoreUpdates
runQ
(mkStoreAnySubmissions wid)
(pure $ Submissions mempty 0 0)
(logScale . operationsDeltaG)

0 comments on commit 4fc8051

Please sign in to comment.