Sha256: e7bf42274792fc1878d48db81a6b7588e2992d5eccce1f0a73fc897a22a14278

Contents?: true

Size: 991 Bytes

Versions: 4

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

4 entries across 4 versions & 1 rubygems

Version Path
licensee-6.1.1 test/test_licensee_npm_bower_matcher.rb
licensee-6.1.0 test/test_licensee_npm_bower_matcher.rb
licensee-6.0.0 test/test_licensee_npm_bower_matcher.rb
licensee-6.0.0b1 test/test_licensee_npm_bower_matcher.rb