1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
# frozen_string_literal: true
require 'minitest/autorun'
require 'sprockets/cache'
require 'sprockets/yui_compressor'
class TestYUICompressor < Minitest::Test
def test_compress_javascript
input = {
content_type: 'application/javascript',
data: "function foo() {\n return true;\n}",
cache: Sprockets::Cache.new
}
output = "function foo(){return true};"
begin
assert_equal output, Sprockets::YUICompressor.call(input)
rescue YUI::Compressor::RuntimeError
skip "No Java runtime present"
end
end
def test_compress_css
input = {
content_type: 'text/css',
data: "h1 {\n color: red;\n}\n",
cache: Sprockets::Cache.new
}
output = "h1{color:red}"
begin
assert_equal output, Sprockets::YUICompressor.call(input)
rescue YUI::Compressor::RuntimeError
skip "No Java runtime present"
end
end
def test_cache_key
assert Sprockets::YUICompressor.cache_key
end
end
|