Sha256: 39886b612958cfcd27612139c2904b9d10d6cdeffdf4de8d0a72a9f057c83b1b

Contents?: true

Size: 1.35 KB

Versions: 6

Compression:

Stored size: 1.35 KB

Contents

require 'spec_helper'

RSpec.describe PortalConnectors::BtcWalletClient do
  let(:client) { PortalConnectors::BtcWalletClient.singleton }

  describe "#get_address", vcr: true do
    it "returns the btc address" do
      address, ok = client.get_address(account_type: "main", account_id: 918)
      expect(address["address"]).to eq("134wJmPWXyumznWWqbJaaM8VBzTwnSgQxD")
    end
  end

  describe "#send_withdrawal", vcr: true do
    it "returns the withdrawal data" do
      resp, ok = client.send_withdrawal(address: "1F4ttRGNspjYMEutMpoUADpgLz9geJNp7Q", amount: 0.123, identifier: "someidentifier")
      expect(ok).to be_truthy
      expect(resp["tx_hash"]).to be_nil
      expect(resp["address"]).to eq("1F4ttRGNspjYMEutMpoUADpgLz9geJNp7Q")
      expect(resp["amount"]).to eq("0.123")
      expect(resp["status"]).to eq("pending")
      expect(resp["identifier"]).to eq("someidentifier")
    end
  end

  describe "#nonce_key" do
    it "related to the class name" do
      expect(client.send :nonce_key).to eq "btc_wallet:nonce"
    end
  end

  describe "#portal_name" do
    it "related to the class name" do
      expect(client.send :portal_name).to eq "btc_wallet"
    end
  end


  describe "#next_nonce" do
    it "auto incremented" do
      expect(client.send :next_nonce).to eq "remitano-1"
      expect(client.send :next_nonce).to eq "remitano-2"
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
portal-connectors-0.58.39xc spec/lib/portal-connectors/btc_wallet_client_spec.rb
portal-connectors-0.58.39xb spec/lib/portal-connectors/btc_wallet_client_spec.rb
portal-connectors-0.58.39xa spec/lib/portal-connectors/btc_wallet_client_spec.rb
portal-connectors-0.58.39fj spec/lib/portal-connectors/btc_wallet_client_spec.rb
portal-connectors-0.58.39fg spec/lib/portal-connectors/btc_wallet_client_spec.rb
portal-connectors-0.58.38xn spec/lib/portal-connectors/btc_wallet_client_spec.rb