forked from input-output-hk/cardano-sl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split deterministic tests into separate modules (input-output-hk#2823)
This patch splits the deterministic tests into separate modules, so that new tests can be added easily on them.
- Loading branch information
1 parent
7f87340
commit c2c6500
Showing
6 changed files
with
324 additions
and
251 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
{-# LANGUAGE RankNTypes #-} | ||
{-# LANGUAGE TupleSections #-} | ||
|
||
module AddressSpecs (addressSpecs) where | ||
|
||
import Universum | ||
|
||
import Cardano.Wallet.Client.Http | ||
import Control.Lens hiding ((^..), (^?)) | ||
import Test.Hspec | ||
|
||
import Util | ||
|
||
|
||
addressSpecs :: WalletRef -> WalletClient IO -> Spec | ||
addressSpecs wRef wc = do | ||
describe "Addresses" $ do | ||
it "Creating an address makes it available" $ do | ||
-- create a wallet | ||
Wallet{..} <- sampleWallet wRef wc | ||
|
||
-- create an account | ||
accResp <- postAccount wc walId (NewAccount Nothing "hello") | ||
acc@Account{..} <- wrData <$> accResp `shouldPrism` _Right | ||
|
||
-- accounts should exist | ||
accResp' <- getAccounts wc walId | ||
accs <- wrData <$> accResp' `shouldPrism` _Right | ||
accs `shouldContain` [acc] | ||
|
||
-- create an address | ||
addResp <- postAddress wc (NewAddress Nothing accIndex walId) | ||
addr <- wrData <$> addResp `shouldPrism` _Right | ||
|
||
-- verify that address is in the API | ||
idxResp <- getAddressIndex wc | ||
addrs <- wrData <$> idxResp `shouldPrism` _Right | ||
|
||
map addrId addrs `shouldContain` [addrId addr] | ||
|
||
it "Index returns real data" $ do | ||
addrsResp <- getAddressIndex wc | ||
addrs <- wrData <$> addrsResp `shouldPrism` _Right | ||
|
||
addrsResp' <- getAddressIndex wc | ||
addrs' <- wrData <$> addrsResp' `shouldPrism` _Right | ||
|
||
addrs `shouldBe` addrs' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.