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

require '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

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

require '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' => 4,
                'Type' => 2
              },
              {
                'Name' => 'hello.txt',
                'Hash' => 'QmfM2r8seH2GiRaC4esTjeraXEachRt8ZsSeGaWTPLyMoG',
                'Size' => 13,
                'Type' => 2
              }
            ]
          }
        ]
      }
      assert_equal expectation, actual
    end
  end

end

Adjust the expectation of a unit test to the changed behavior
Adjust the expectation of a unit test to the changed behavior

Since version 0.4.19 "ipfs ls" is reporting files size rather than DAG size,
see https://github.com/ipfs/go-ipfs/blob/master/CHANGELOG.md#-file-listing
