Skip to content

Commit

Permalink
add integration test for GET /blocks/latest/header end-point
Browse files Browse the repository at this point in the history
  • Loading branch information
paolino committed Aug 9, 2022
1 parent 68eae50 commit d18c044
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/core-integration/cardano-wallet-core-integration.cabal
Expand Up @@ -99,6 +99,7 @@ library
Test.Integration.Framework.Request
Test.Integration.Framework.TestData
Test.Integration.Plutus
Test.Integration.Scenario.API.Blocks
Test.Integration.Scenario.API.Byron.Wallets
Test.Integration.Scenario.API.Byron.HWWallets
Test.Integration.Scenario.API.Byron.Addresses
Expand Down
30 changes: 30 additions & 0 deletions lib/core-integration/src/Test/Integration/Scenario/API/Blocks.hs
@@ -0,0 +1,30 @@

{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}

module Test.Integration.Scenario.API.Blocks
( spec
) where

import Prelude

import Cardano.Wallet.Api.Types.BlockHeader
( ApiBlockHeader )
import Test.Hspec
( SpecWith, describe )
import Test.Hspec.Extra
( it )
import Test.Integration.Framework.DSL
( Context (..), Headers (..), Payload (..), expectResponseCode, request )

import qualified Cardano.Wallet.Api.Link as Link
import qualified Network.HTTP.Types.Status as HTTP

spec :: SpecWith Context
spec = describe "BLOCKS" $ do
it "LATEST_BLOCK Current tip is reported" $ \ctx -> do
r <- request @ApiBlockHeader ctx Link.getBlocksLatestHeader Default Empty
print r
expectResponseCode @IO HTTP.status200 r
4 changes: 3 additions & 1 deletion lib/shelley/test/integration/shelley-integration-test.hs
Expand Up @@ -40,7 +40,7 @@ import Cardano.Startup
, withUtf8Encoding
)
import Cardano.Wallet.Api.Types
( DecodeAddress (..), EncodeAddress (..) )
( AccountPostData (name), DecodeAddress (..), EncodeAddress (..) )
import Cardano.Wallet.Logging
( BracketLog, bracketTracer, stdoutTextTracer, trMessageText )
import Cardano.Wallet.Network.Ports
Expand Down Expand Up @@ -148,6 +148,7 @@ import qualified Cardano.BM.Backend.EKGView as EKG
import qualified Cardano.Pool.DB as Pool
import qualified Cardano.Pool.DB.Sqlite as Pool
import qualified Data.Text as T
import qualified Test.Integration.Scenario.API.Blocks as Blocks
import qualified Test.Integration.Scenario.API.Byron.Addresses as ByronAddresses
import qualified Test.Integration.Scenario.API.Byron.CoinSelections as ByronCoinSelections
import qualified Test.Integration.Scenario.API.Byron.HWWallets as ByronHWWallets
Expand Down Expand Up @@ -189,6 +190,7 @@ main = withTestsSetup $ \testDir tracers -> do
parallel $ do
Addresses.spec @n
CoinSelections.spec @n
Blocks.spec @n
ByronAddresses.spec @n
ByronCoinSelections.spec @n
Wallets.spec @n
Expand Down

0 comments on commit d18c044

Please sign in to comment.