Skip to content

Commit cd062e9

Browse files
author
Piotr Stachyra
committed
Additional assertion on decoding in construct->sign->submit testsv
1 parent 9ecf8ee commit cd062e9

File tree

1 file changed

+26
-6
lines changed

1 file changed

+26
-6
lines changed

test/e2e/spec/e2e_spec.rb

Lines changed: 26 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,10 @@ def run_contract(contract_setup, scripts)
283283
tx_constructed = SHELLEY.transactions.construct(@wid, payment)
284284
expect(tx_constructed).to be_correct_and_respond 202
285285
expected_fee = tx_constructed['fee']['quantity']
286-
decoded_fee = SHELLEY.transactions.decode(@wid, tx_constructed["transaction"])['fee']['quantity']
286+
tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed["transaction"])
287+
expect(tx_decoded).to be_correct_and_respond 202
288+
289+
decoded_fee = tx_decoded['fee']['quantity']
287290
expect(expected_fee).to eq decoded_fee
288291

289292
tx_signed = SHELLEY.transactions.sign(@wid, PASS, tx_constructed['transaction'])
@@ -324,7 +327,10 @@ def run_contract(contract_setup, scripts)
324327
tx_constructed = SHELLEY.transactions.construct(@wid, payment)
325328
expect(tx_constructed).to be_correct_and_respond 202
326329
expected_fee = tx_constructed['fee']['quantity']
327-
decoded_fee = SHELLEY.transactions.decode(@wid, tx_constructed["transaction"])['fee']['quantity']
330+
tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed["transaction"])
331+
expect(tx_decoded).to be_correct_and_respond 202
332+
333+
decoded_fee = tx_decoded['fee']['quantity']
328334
expect(expected_fee).to eq decoded_fee
329335

330336
tx_signed = SHELLEY.transactions.sign(@wid, PASS, tx_constructed['transaction'])
@@ -371,7 +377,10 @@ def run_contract(contract_setup, scripts)
371377
tx_constructed = SHELLEY.transactions.construct(@wid, payment)
372378
expect(tx_constructed).to be_correct_and_respond 202
373379
expected_fee = tx_constructed['fee']['quantity']
374-
decoded_fee = SHELLEY.transactions.decode(@wid, tx_constructed["transaction"])['fee']['quantity']
380+
tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed["transaction"])
381+
expect(tx_decoded).to be_correct_and_respond 202
382+
383+
decoded_fee = tx_decoded['fee']['quantity']
375384
expect(expected_fee).to eq decoded_fee
376385

377386
tx_signed = SHELLEY.transactions.sign(@wid, PASS, tx_constructed['transaction'])
@@ -419,7 +428,10 @@ def run_contract(contract_setup, scripts)
419428
withdrawal = tx_constructed['coin_selection']['withdrawals'].map { |x| x['amount']['quantity'] }.first
420429
expect(withdrawal).to eq 0
421430
expected_fee = tx_constructed['fee']['quantity']
422-
decoded_fee = SHELLEY.transactions.decode(@wid, tx_constructed["transaction"])['fee']['quantity']
431+
tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed["transaction"])
432+
expect(tx_decoded).to be_correct_and_respond 202
433+
434+
decoded_fee = tx_decoded['fee']['quantity']
423435
expect(expected_fee).to eq decoded_fee
424436

425437
tx_signed = SHELLEY.transactions.sign(@wid, PASS, tx_constructed['transaction'])
@@ -451,7 +463,10 @@ def run_contract(contract_setup, scripts)
451463
metadata)
452464
expect(tx_constructed).to be_correct_and_respond 202
453465
expected_fee = tx_constructed['fee']['quantity']
454-
decoded_fee = SHELLEY.transactions.decode(@wid, tx_constructed["transaction"])['fee']['quantity']
466+
tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed["transaction"])
467+
expect(tx_decoded).to be_correct_and_respond 202
468+
469+
decoded_fee = tx_decoded['fee']['quantity']
455470
expect(expected_fee).to eq decoded_fee
456471

457472
tx_signed = SHELLEY.transactions.sign(@wid, PASS, tx_constructed['transaction'])
@@ -548,6 +563,8 @@ def run_contract(contract_setup, scripts)
548563

549564
# Check fee and deposit on quitting
550565
decoded_tx = SHELLEY.transactions.decode(@target_id, tx_constructed["transaction"])
566+
expect(decoded_tx).to be_correct_and_respond 202
567+
551568
expect(tx_constructed['coin_selection']['deposits_taken']).to eq []
552569
expect(decoded_tx['deposits_taken']).to eq []
553570
deposit_returned = tx_constructed['coin_selection']['deposits_returned'].first['quantity']
@@ -1237,7 +1254,10 @@ def test_byron_assets_tx(source_id, target_id)
12371254
tx_constructed = SHELLEY.transactions.construct(@wid, payment)
12381255
expect(tx_constructed).to be_correct_and_respond 202
12391256
expected_fee = tx_constructed['fee']['quantity']
1240-
decoded_fee = SHELLEY.transactions.decode(@wid, tx_constructed["transaction"])['fee']['quantity']
1257+
tx_decoded = SHELLEY.transactions.decode(@wid, tx_constructed["transaction"])
1258+
expect(tx_decoded).to be_correct_and_respond 202
1259+
1260+
decoded_fee = tx_decoded['fee']['quantity']
12411261
expect(expected_fee).to eq decoded_fee
12421262

12431263
tx_signed = SHELLEY.transactions.sign(@wid, PASS, tx_constructed['transaction'])

0 commit comments

Comments
 (0)