1+ # frozen_string_literal: true
2+
13require 'test/unit'
24require_relative '../key_loader'
35require_relative '../checks'
46require_relative '../../lib/cryptomarket/client'
57
6- class TestRestTradingMethods < Test ::Unit ::TestCase
8+ class TestRestTradingMethods < Test ::Unit ::TestCase # rubocop:disable Metrics/ClassLength,Style/Documentation
79 def setup
8- @client = Cryptomarket ::Client . new api_key : Keyloader . api_key , api_secret : Keyloader . api_secret
10+ @client = Cryptomarket ::Client . new api_key : KeyLoader . api_key , api_secret : KeyLoader . api_secret
911 end
1012
1113 def test_get_wallet_balances
1214 result = @client . get_wallet_balances
13- assert ( good_list (
14- -> ( balance ) do good_balance ( balance ) end ,
15- result
16- ) )
15+ assert ( good_list ( -> ( balance ) { Check . good_balance ( balance ) } , result ) )
1716 end
1817
1918 def test_get_wallet_balance
@@ -23,45 +22,32 @@ def test_get_wallet_balance
2322
2423 def test_get_deposit_crypto_addresses
2524 result = @client . get_deposit_crypto_addresses
26- assert ( good_list (
27- -> ( address ) do good_address ( address ) end ,
28- result
29- ) )
25+ assert ( good_list ( -> ( address ) { Check . good_address ( address ) } , result ) )
3026 end
3127
3228 def test_get_deposit_crypto_address
3329 result = @client . get_deposit_crypto_address currency : 'ADA'
34- assert ( good_address ( result ) )
30+ assert ( Check . good_address ( result ) )
3531 end
3632
3733 def test_create_deposit_crypto_address
3834 result = @client . create_deposit_crypto_address currency : 'ADA'
39- assert ( good_address ( result ) )
35+ assert ( Check . good_address ( result ) )
4036 end
4137
4238 def test_get_last_10_deposit_crypto_addresses
4339 result = @client . get_last_10_deposit_crypto_addresses currency : 'ADA'
44- assert ( good_list (
45- -> ( address ) do good_address ( address ) end ,
46- result
47- ) )
40+ assert ( good_list ( -> ( address ) { Check . good_address ( address ) } , result ) )
4841 end
4942
5043 def test_get_last_10_withdrawal_crypto_addresses
5144 result = @client . get_last_10_withdrawal_crypto_addresses currency : 'CLP'
52- assert ( good_list (
53- -> ( address ) do good_address ( address ) end ,
54- result
55- ) )
45+ assert ( good_list ( -> ( address ) { Check . good_address ( address ) } , result ) )
5646 end
5747
5848 def test_withdraw_crypto
5949 ada_address = @client . get_deposit_crypto_address ( currency : 'ADA' ) [ 'address' ]
60- transaction_id = @client . withdraw_crypto (
61- currency : 'ADA' ,
62- amount : '0.1' ,
63- address : ada_address
64- )
50+ transaction_id = @client . withdraw_crypto ( currency : 'ADA' , amount : '0.1' , address : ada_address )
6551 assert ( !transaction_id . empty? )
6652 end
6753
@@ -105,7 +91,7 @@ def test_crypto_address_belongs_to_current_account
10591 assert ( it_belongs )
10692 end
10793
108- def test_transfer_between_wallet_and_exchange
94+ def test_transfer_between_wallet_and_exchange # rubocop:disable Metrics/MethodLength
10995 result = @client . transfer_between_wallet_and_exchange (
11096 currency : 'CRO' ,
11197 amount : '0.1' ,
@@ -125,7 +111,7 @@ def test_transfer_between_wallet_and_exchange
125111 def test_get_transaction_history
126112 result = @client . get_transaction_history
127113 assert ( good_list (
128- -> ( transaction ) do good_transaction ( transaction ) end ,
114+ -> ( transaction ) do Check . good_transaction ( transaction ) end ,
129115 result
130116 ) )
131117 end
@@ -134,7 +120,7 @@ def test_get_transaction
134120 transaction_list = @client . get_transaction_history
135121 first_transaction_id = transaction_list [ 0 ] [ 'native' ] [ 'tx_id' ]
136122 result = @client . get_transaction id : first_transaction_id
137- assert ( good_transaction ( result ) )
123+ assert ( Check . good_transaction ( result ) )
138124 end
139125
140126 def test_offchain_available
0 commit comments