test/zold/test_wts.rb in zold-ruby-sdk-0.1.0 vs test/zold/test_wts.rb in zold-ruby-sdk-0.2.0

- old
+ new

@@ -18,44 +18,54 @@ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE # SOFTWARE. +require 'loog' require 'minitest/autorun' require_relative '../../lib/zold/wts' # WTS test. # Author:: Yegor Bugayenko (yegor256@gmail.com) # Copyright:: Copyright (c) 2018-2019 Yegor Bugayenko # License:: MIT class TestWTS < Minitest::Test - KEY = '8HNxjYuEFp0....LYOWxsEaC3rQ==' + KEY = '0000000000000000-b416493aefae4ca487c4739050aaec15' def test_pulls - skip if KEY.length < 50 - wts = Zold::WTS.new(KEY) + wts = Zold::WTS.new(KEY, log: Loog::VERBOSE) job = wts.pull wts.wait(job) assert(!job.nil?) end def test_finds_transactions - skip if KEY.length < 50 - wts = Zold::WTS.new(KEY) + wts = Zold::WTS.new(KEY, log: Loog::VERBOSE) job = wts.pull wts.wait(job) - assert_equal(1, wts.find(details: /^for hosting$/).count) + assert_equal(0, wts.find(details: /^for hosting$/).count) end def test_retrieves_wallet_id - skip if KEY.length < 50 - wts = Zold::WTS.new(KEY) + wts = Zold::WTS.new(KEY, log: Loog::VERBOSE) assert(!wts.id.nil?) end def test_retrieves_balance - skip if KEY.length < 50 - wts = Zold::WTS.new(KEY) + wts = Zold::WTS.new(KEY, log: Loog::VERBOSE) + job = wts.pull + wts.wait(job) + assert(!wts.balance.nil?) + end + + def test_retrieves_usd_rate + wts = Zold::WTS.new(KEY, log: Loog::VERBOSE) + rate = wts.usd_rate + assert(!rate.nil?) + end + + def test_works_with_fake + wts = Zold::WTS::Fake.new job = wts.pull wts.wait(job) assert(!wts.balance.zero?) end end