Skip to content
This repository was archived by the owner on Mar 1, 2019. It is now read-only.

Commit 3217c2a

Browse files
authored
Merge pull request #288 from input-output-hk/new_test_for_190
additional test for UtxoNotEnoughFragmented
2 parents e57487e + 09581e2 commit 3217c2a

File tree

1 file changed

+38
-1
lines changed

1 file changed

+38
-1
lines changed

test/integration/Test/Integration/Scenario/Transactions.hs

+38-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ spec = do
3737
, expectTxStatusEventually [InNewestBlocks]
3838
]
3939

40-
4140
scenario "not enough fragmentation of utxo forbids multi-output transaction" $ do
4241
fixtureSource <- setup $ defaultSetup
4342
& initialCoins .~ [100000]
@@ -64,6 +63,44 @@ spec = do
6463
[ expectWalletError (UtxoNotEnoughFragmented (Client.ErrUtxoNotEnoughFragmented 1 Client.msgUtxoNotEnoughFragmented))
6564
]
6665

66+
scenario "cannot send subsequent transaction when the first one is pending" $ do
67+
fixtureSource <- setup $ defaultSetup
68+
& initialCoins .~ [10000000]
69+
& rawPassword .~ "raw password"
70+
71+
fixtureDest <- setup $ defaultSetup
72+
73+
-- Running two transactions one after another. Not waiting for the first transaction to be "completed".
74+
-- The second transaction returns UtxoNotEnoughFragmented because the first one is still "pending"
75+
resp1 <- request $ Client.postTransaction $- Payment
76+
(defaultSource fixtureSource)
77+
(defaultDistribution 1 fixtureDest)
78+
defaultGroupingPolicy
79+
(Just $ fixtureDest ^. spendingPassword)
80+
verify resp1
81+
[ expectSuccess
82+
]
83+
84+
resp2 <- request $ Client.postTransaction $- Payment
85+
(defaultSource fixtureSource)
86+
(defaultDistribution 1 fixtureDest)
87+
defaultGroupingPolicy
88+
(Just $ fixtureDest ^. spendingPassword)
89+
verify resp2
90+
[ expectWalletError (UtxoNotEnoughFragmented (Client.ErrUtxoNotEnoughFragmented 1 Client.msgUtxoNotEnoughFragmented))
91+
]
92+
93+
-- only after the first transaction completes the next one can be successfully sent
94+
expectTxStatusEventually [InNewestBlocks, Persisted] resp1
95+
96+
resp3 <- request $ Client.postTransaction $- Payment
97+
(defaultSource fixtureSource)
98+
(defaultDistribution 1 fixtureDest)
99+
defaultGroupingPolicy
100+
(Just $ fixtureDest ^. spendingPassword)
101+
verify resp3
102+
[ expectTxStatusEventually [InNewestBlocks, Persisted]
103+
]
67104

68105
scenario "successful payment appears in the history" $ do
69106
fixture <- setup $ defaultSetup

0 commit comments

Comments
 (0)