Sha256: 27fa425a18940aaf59d074be491208480fbc5744abddb02130c11ab2178fc47f

Contents?: true

Size: 1.08 KB

Versions: 22

Compression:

Stored size: 1.08 KB

Contents

require "test_helper"

class TestJavaScriptDependencyResolver < Test::Unit::TestCase

  def setup
    @resolver = Juicer::JavaScriptDependencyResolver.new
    Juicer::Test::FileSetup.new.create
  end

  def test_init
    assert_equal [], @resolver.files
  end

  def test_resolve
    b_file = path('b.js')
    a_file = path('a.js')

    files = @resolver.resolve(a_file) do |file|
      assert b_file == file || a_file == file, file
      b_file != file
    end

    assert_equal [a_file], files

    files = @resolver.resolve(a_file) do |file|
      assert b_file == file || a_file == file
      true
    end

    assert_equal [a_file, b_file], files.sort

    files = @resolver.resolve(b_file) do |file|
      assert b_file == file || a_file == file
      true
    end

    assert_equal [a_file, b_file], files.sort
  end

  def test_directory_resolve
    my_app = path("my_app.js")
    expected_files = %w(pkg/pkg.js
    pkg/module/moda.js
    pkg/module/modb.js
    my_app.js).map{|file| path(file)}

    actual_files = @resolver.resolve(my_app)
    assert_equal expected_files, actual_files
  end
end

Version data entries

22 entries across 22 versions & 3 rubygems

Version Path
juicer-1.0.16 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
juicer-1.0.15 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
juicer-1.0.14 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
juicer-1.0.13 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
psyho_juicer-1.0.11 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
juicer-1.0.12 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
juicer-1.0.11 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
juicer-1.0.10 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
psyho_juicer-1.0.9 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
juicer-1.0.9 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
juicer-1.0.8 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
juicer-1.0.7 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
psyho_juicer-1.0.7 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
juicer-1.0.6 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
juicer-1.0.5 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
juicer-1.0.4 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
juicer-1.0.3 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
juicer-1.0.2 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
juicer-1.0.1 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb
psyho_juicer-1.0.0 test/unit/juicer/dependency_resolver/javascript_dependency_resolver_test.rb