File: test_jsminc_compressor.rb

package info (click to toggle)
ruby-sprockets 4.2.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,964 kB
  • sloc: ruby: 13,014; javascript: 157; makefile: 4
file content (24 lines) | stat: -rw-r--r-- 617 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# frozen_string_literal: true
require 'minitest/autorun'
require 'sprockets/cache'
unless RUBY_PLATFORM.include?('java')
  require 'sprockets/jsminc_compressor'

  class TestJSMincCompressor < 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;}"

      assert_equal output, Sprockets::JSMincCompressor.call(input)
    end

    def test_cache_key
      assert Sprockets::JSMincCompressor.cache_key
    end
  end
end