Skip to content

Commit

Permalink
rebase after #613
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Stachyra committed Aug 14, 2019
1 parent 7e8882c commit 8838fb4
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 32 deletions.
14 changes: 4 additions & 10 deletions lib/core-integration/src/Test/Integration/Framework/DSL.hs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ module Test.Integration.Framework.DSL
, direction
, feeEstimator
, inputs
, insertedAt
, insertedAtTime
, passphraseLastUpdate
, state
, status
Expand Down Expand Up @@ -681,8 +681,8 @@ direction =
_set :: HasType (ApiT Direction) s => (s, Direction) -> s
_set (s, v) = set typed (ApiT v) s

insertedAt :: HasType (Maybe ApiBlockData) s => Lens' s (Maybe UTCTime)
insertedAt =
insertedAtTime :: HasType (Maybe ApiBlockData) s => Lens' s (Maybe UTCTime)
insertedAtTime =
lens _get _set
where
_get :: HasType (Maybe ApiBlockData) s => s -> (Maybe UTCTime)
Expand Down Expand Up @@ -890,7 +890,7 @@ listTransactions ctx wallet mStart mEnd mOrder = do
(_, txs) <- unsafeRequest @[ApiTransaction t] ctx path Empty
return txs
where
path = listTransactionsEp wallet $ toQueryString $ catMaybes
path = listTxEp wallet $ toQueryString $ catMaybes
[ ("start", ) . toText <$> (Iso8601Time <$> mStart)
, ("end" , ) . toText <$> (Iso8601Time <$> mEnd )
, ("order", ) . toText <$> mOrder
Expand Down Expand Up @@ -996,12 +996,6 @@ getAddressesEp w stateFilter =
, "v2/wallets/" <> w ^. walletId <> "/addresses" <> stateFilter
)

listTransactionsEp :: ApiWallet -> Text -> (Method, Text)
listTransactionsEp w stateFilter =
( "GET"
, "v2/wallets/" <> w ^. walletId <> "/transactions" <> stateFilter
)

postTxEp :: ApiWallet -> (Method, Text)
postTxEp w =
( "POST"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ import Test.Integration.Framework.DSL
, fixtureWallet
, fixtureWalletWith
, getWalletEp
, insertedAt
, insertedAtTime
, json
, getFromResponse
, getFromResponseList
Expand All @@ -81,8 +81,6 @@ import Test.Integration.Framework.DSL
, walletId
, utcIso8601ToText
)
import Test.Hspec.Expectations.Lifted
( shouldBe )
import Test.Integration.Framework.Request
( RequestException )
import Test.Integration.Framework.TestData
Expand Down Expand Up @@ -1079,27 +1077,27 @@ spec = do
, expectListItemFieldEqual 1 status InLedger
]

-- | This scenario covers the following matrix of cases. Cases where generated
-- This scenario covers the following matrix of cases. Cases where generated
-- using one of parwise test cases generation tools available online.
-- +----+----------+----------+------------+--------------+
-- | | start | end | order | result |
-- | start | end | order | result |
-- +----+----------+----------+------------+--------------+
-- | 1 | edge | edge | ascending | 2 ascending |
-- | 2 | edge | edge + 1 | descending | 2 descending |
-- | 3 | edge | edge - 1 | empty | 1st one |
-- | 4 | edge | empty | empty | 2 descending |
-- | 5 | edge + 1 | edge + 1 | empty | 2nd one |
-- | 6 | edge + 1 | edge - 1 | empty | none |
-- | 7 | edge + 1 | empty | ascending | 2nd one |
-- | 8 | edge + 1 | edge | descending | 2nd one |
-- | 9 | edge - 1 | edge - 1 | ascending | 1st one |
-- | 10 | edge - 1 | empty | descending | 2 descending |
-- | 11 | edge - 1 | edge | empty | 2 descending |
-- | 12 | edge - 1 | edge + 1 | empty | 2 descending |
-- | 13 | empty | empty | empty | 2 descending |
-- | 14 | empty | edge | empty | 2 descending |
-- | 15 | empty | edge + 1 | ascending | 2 ascending |
-- | 16 | empty | edge - 1 | descending | 1st one |
-- 1 | edge | edge | ascending | 2 ascending |
-- 2 | edge | edge + 1 | descending | 2 descending |
-- 3 | edge | edge - 1 | empty | 1st one |
-- 4 | edge | empty | empty | 2 descending |
-- 5 | edge + 1 | edge + 1 | empty | 2nd one |
-- 6 | edge + 1 | edge - 1 | empty | none |
-- 7 | edge + 1 | empty | ascending | 2nd one |
-- 8 | edge + 1 | edge | descending | 2nd one |
-- 9 | edge - 1 | edge - 1 | ascending | 1st one |
-- 10 | edge - 1 | empty | descending | 2 descending |
-- 11 | edge - 1 | edge | empty | 2 descending |
-- 12 | edge - 1 | edge + 1 | empty | 2 descending |
-- 13 | empty | empty | empty | 2 descending |
-- 14 | empty | edge | empty | 2 descending |
-- 15 | empty | edge + 1 | ascending | 2 ascending |
-- 16 | empty | edge - 1 | descending | 1st one |
-- +----+----------+----------+------------+--------------+
it "TRANS_LIST_02,03 - Can limit/order results with start, end and order" $ \ctx -> do
(_, w, [(t1, a1), (t2, a2)]) <- fixtureWalletManyTxs ctx [10,20]
Expand Down Expand Up @@ -1591,6 +1589,6 @@ spec = do
r <- request @([ApiTransaction t]) ctx (listTxEp wDest "?order=ascending")
Default Empty
let indexes = [0..(length txAmounts - 1)]
let txTimes = map (\x -> fromJust $ getFromResponseList x insertedAt r) indexes
let txTimes = map (\x -> fromJust $ getFromResponseList x insertedAtTime r) indexes
let wDestTxList = zip txTimes txAmounts
return (wSrc, wDest, wDestTxList)

0 comments on commit 8838fb4

Please sign in to comment.