Sha256: c995f88315bfb0345022ef5a693866eaf6d86a3a3a56915d6e3adfa696eb6c3e

Contents?: true

Size: 1003 Bytes

Versions: 2

Compression:

Stored size: 1003 Bytes

Contents

$:.unshift File.expand_path('../..', __FILE__)

require 'test/samples'
require 'ipfs-api'

include IPFS

class CommandLsTest < Minitest::Test

  def test_ls
    ipfs = Connection.new
    Samples.some_virtual_folders do |fixture, expectation|
      ipfs.add fixture
      actual = ipfs.ls('QmcsmfcY8SQzNxJQYGZMHLXCkeTgxDBhASDPJyVEGi8Wrv')
      expectation = {
        'Objects' => [
          {
            'Hash' => 'QmcsmfcY8SQzNxJQYGZMHLXCkeTgxDBhASDPJyVEGi8Wrv',
            'Links' => [
              {
                'Name' => 'foo.txt',
                'Hash' => 'QmTz3oc4gdpRMKP2sdGUPZTAGRngqjsi99BPoztyP53JMM',
                'Size' => 12,
                'Type' => 2
              },
              {
                'Name' => 'hello.txt',
                'Hash' => 'QmfM2r8seH2GiRaC4esTjeraXEachRt8ZsSeGaWTPLyMoG',
                'Size' => 21,
                'Type' => 2
              }
            ]
          }
        ]
      }
      assert_equal expectation, actual
    end
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
ipfs-api-0.2.0 test/test_cmd_ls.rb
ipfs-api-0.1.0 test/test_cmd_ls.rb