Sha256: ca886166f2907af0bba99bf954b160d4cc69b1e6c24c4f4036dbbc3b05d94230

Contents?: true

Size: 1.04 KB

Versions: 4

Compression:

Stored size: 1.04 KB

Contents

require "webpacker_test"

class ManifestTest < Minitest::Test
  def test_file_path
    file_path = File.join(File.dirname(__FILE__), "test_app/public/packs", "manifest.json").to_s
    assert_equal Webpacker::Manifest.file_path.to_s, file_path
  end

  def test_lookup_exception
    manifest_path = File.join(File.dirname(__FILE__), "test_app/public/packs", "manifest.json").to_s
    asset_file = "calendar.js"

    error = assert_raises Webpacker::FileLoader::NotFoundError do
      Webpacker::Manifest.lookup(asset_file)
    end

    assert_equal error.message, "Can't find #{asset_file} in #{manifest_path}. Is webpack still compiling?"
  end

  def test_lookup_success
    asset_file = "bootstrap.js"
    assert_equal Webpacker::Manifest.lookup(asset_file), "/packs/bootstrap-300631c4f0e0f9c865bc.js"
  end

  def test_lookup_path
    file_path = File.join(File.dirname(__FILE__), "test_app/public/packs", "bootstrap-300631c4f0e0f9c865bc.js").to_s
    asset_file = "bootstrap.js"
    assert_equal Webpacker::Manifest.lookup_path(asset_file).to_s, file_path
  end
end

Version data entries

4 entries across 4 versions & 2 rubygems

Version Path
webpacker-legacy-0.1.2 test/manifest_test.rb
webpacker-legacy-0.1.1 test/manifest_test.rb
webpacker-legacy-0.1.0 test/manifest_test.rb
webpacker-2.0 test/manifest_test.rb