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