Skip to content

Commit

Permalink
polish scenarios
Browse files Browse the repository at this point in the history
  • Loading branch information
Piotr Stachyra authored and piotr-iohk committed Mar 15, 2023
1 parent 984018d commit 8b88744
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 9 deletions.
2 changes: 1 addition & 1 deletion test/e2e/helpers/cardano_cli.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ def initialize(protocol_magic)
end

def cli(*options)
cmd(%(cardano-cli #{options.join(' ')}), display_result: true)
cmd(%(cardano-cli #{options.join(' ')}))
end

def build_script_address(script_file_path)
Expand Down
15 changes: 15 additions & 0 deletions test/e2e/helpers/tx_history.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,21 @@ def tx_mint_burn(tx, mint: nil, burn: nil)
expect(tx['burn']['tokens']).to eq burn if burn
end

def tx_has_mint_or_burn(tx, mint: true, burn: true)
if mint
expect(tx['mint']['tokens']).not_to eq []
else
expect(tx['mint']['tokens']).to eq []
end

if burn
expect(tx['burn']['tokens']).not_to eq []
else
expect(tx['burn']['tokens']).to eq []
end
end


def tx_validity_interval(tx, invalid_before: before, invalid_hereafter: hereafter)
expect(tx['validity_interval']['invalid_before']).to eq({ 'quantity' => invalid_before, 'unit' => 'slot' })
expect(tx['validity_interval']['invalid_hereafter']).to eq({ 'quantity' => invalid_hereafter, 'unit' => 'slot' })
Expand Down
16 changes: 8 additions & 8 deletions test/e2e/spec/e2e_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@

# 3. [cardano-cli] Submit minting transaction using reference script sending minted tokens to wallet address

wallet_id = '80b24aa6361e1f62e7d252e614f7d649870ab542'
wallet_id = '305f19e7a384f89e6f5e36025ff5e9a22d33cd6b'
txs = SHELLEY.transactions.list(wallet_id)
expect(txs).to be_correct_and_respond 200

Expand Down Expand Up @@ -105,11 +105,11 @@
tx_script_validity(tx_details, 'valid')
tx_status(tx_details, 'in_ledger')
tx_collateral(tx_details, present: true)
tx_collateral_outputs(tx_details, present: false)
tx_collateral_outputs(tx_details, present: true)
tx_metadata(tx_details, nil)
tx_deposits(tx_details, deposit_taken: 0, deposit_returned: 0)
tx_withdrawals(tx_details, present: false)
tx_mint_burn(tx_details, mint: [], burn: [])
tx_has_mint_or_burn(tx_details, mint: true, burn: false)
tx_extra_signatures(tx_details, present: true)
tx_script_integrity(tx_details, present: true)
tx_validity_interval_default(tx_details)
Expand Down Expand Up @@ -158,7 +158,7 @@
end

# 3. [cardano-cli] Submit minting transaction using reference script sending minted tokens to wallet address
wallet_id = '4cc8afc12c70b0f70e0de45670ea3744ffed1522'
wallet_id = '305f19e7a384f89e6f5e36025ff5e9a22d33cd6b'
txs = SHELLEY.transactions.list(wallet_id)
expect(txs).to be_correct_and_respond 200

Expand Down Expand Up @@ -193,14 +193,14 @@
tx_direction(tx_details, 'incoming')
tx_script_validity(tx_details, 'valid')
tx_status(tx_details, 'in_ledger')
tx_collateral(tx_details, present: true)
tx_collateral(tx_details, present: false)
tx_collateral_outputs(tx_details, present: false)
tx_metadata(tx_details, nil)
tx_deposits(tx_details, deposit_taken: 0, deposit_returned: 0)
tx_withdrawals(tx_details, present: false)
tx_mint_burn(tx_details, mint: [], burn: [])
tx_extra_signatures(tx_details, present: true)
tx_script_integrity(tx_details, present: true)
tx_has_mint_or_burn(tx_details, mint: true, burn: false)
tx_extra_signatures(tx_details, present: false)
tx_script_integrity(tx_details, present: false)
tx_validity_interval_default(tx_details)
tx_certificates(tx_details, present: false)

Expand Down

0 comments on commit 8b88744

Please sign in to comment.