<commit_before># frozen_string_literal: true

require_relative "test-helper"

class TestLicenses < Test::Unit::TestCase
  def test_licenses
    VCR.use_cassette("test_licenses") do
      res = Serrano.licenses
      assert_equal(4, res.length)
      assert_equal(Hash, res.class)
      assert_equal("license-list", res["message-type"])
      assert_true(res["message"]["items"].length > 100)
    end
  end

  def test_licenses_query
    VCR.use_cassette("test_licenses_query") do
      res = Serrano.licenses(query: "creative")
      assert_equal(4, res.length)
      assert_equal(Hash, res.class)
      assert_true(res["message"]["items"].length < 200)
      assert_equal(MatchData, res["message"]["items"][3]["URL"].match("creative").class)
    end
  end

  def test_licenses_limit
    # limit doesn't work on this route
    VCR.use_cassette("test_licenses_limit") do
      res = Serrano.licenses(limit: 3)
      assert_true(res["message"]["items"].length > 100)
    end
  end
end<commit_msg>fix a few tests for licenses route<commit_after># frozen_string_literal: true

require_relative "test-helper"

class TestLicenses < Test::Unit::TestCase
  def test_licenses
    VCR.use_cassette("test_licenses") do
      res = Serrano.licenses
      assert_equal(4, res.length)
      assert_equal(Hash, res.class)
      assert_equal("license-list", res["message-type"])
      assert_equal(Array, res["message"]["items"].class)
    end
  end

  def test_licenses_query
    VCR.use_cassette("test_licenses_query") do
      res = Serrano.licenses(query: "creative")
      assert_equal(4, res.length)
      assert_equal(Hash, res.class)
      assert_equal(Array, res["message"]["items"].class)
      assert_equal(MatchData, res["message"]["items"][3]["URL"].match("creative").class)
    end
  end

  def test_licenses_limit
    # limit doesn't work on this route
    VCR.use_cassette("test_licenses_limit") do
      res = Serrano.licenses(limit: 3)
      assert_equal(Array, res["message"]["items"].class)
    end
  end
end
{'fraction_non_alphanumeric': 0.12922465208747516, 'fraction_numerical': 0.008449304174950299, 'mean_word_length': 3.982673267326733, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6574245', 'n_tokens_mistral': 668, 'n_tokens_neox': 664, 'n_words': 123}