Sha256: afde7a034a983850afb092d5e525b045c01172efeefcf84b604117fa3e7898fa

Contents?: true

Size: 991 Bytes

Versions: 9

Compression:

Stored size: 991 Bytes

Contents

require 'helper'

class TestLicenseeNpmBowerMatchers < Minitest::Test
  should 'detect NPM files' do
    pkg = File.read fixture_path('npm/package.json')
    pkgfile = Licensee::Project::PackageInfo.new(pkg)
    matcher = Licensee::Matchers::NpmBower.new(pkgfile)
    assert_equal 'mit', matcher.send(:license_property)
    assert_equal 'mit', matcher.match.key
  end

  should 'detect Bower files' do
    pkg = File.read fixture_path('bower/bower.json')
    pkgfile = Licensee::Project::PackageInfo.new(pkg)
    matcher = Licensee::Matchers::NpmBower.new(pkgfile)
    assert_equal 'mit', matcher.send(:license_property)
    assert_equal 'mit', matcher.match.key
  end

  should 'not err on non-spdx licenses' do
    pkg = File.read fixture_path('npm-non-spdx/package.json')
    pkgfile = Licensee::Project::PackageInfo.new(pkg)
    matcher = Licensee::Matchers::NpmBower.new(pkgfile)
    assert_equal 'mit-1.0', matcher.send(:license_property)
    assert_equal nil, matcher.match
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
licensee-8.5.0 test/licensee/matchers/test_npm_bower_matcher.rb
licensee-8.4.0 test/licensee/matchers/test_npm_bower_matcher.rb
licensee-8.3.1 test/test_licensee_npm_bower_matcher.rb
licensee-8.3.0 test/test_licensee_npm_bower_matcher.rb
licensee-8.2.0 test/test_licensee_npm_bower_matcher.rb
licensee-8.1.0 test/test_licensee_npm_bower_matcher.rb
licensee-8.0.0 test/test_licensee_npm_bower_matcher.rb
licensee-7.0.1 test/test_licensee_npm_bower_matcher.rb
licensee-7.0.0 test/test_licensee_npm_bower_matcher.rb