<commit_before>require 'test_helper'

class ApplicationHelperTest < ActionView::TestCase
  test '.commaify delimits the given number with commas' do
    assert_equal "22,123,456", commaify(22123456)
    assert_equal "22,123,456", commaify("22123456")
  end

  test '#cover, given a pa, returns an image tag to the asset controller' do
    pa = FactoryGirl.create(:protected_area, name: "Manbone")

    expected_tag = %Q{<img alt="Manbone" data-async="/assets/tiles/#{pa.wdpa_id}?type=protected_area&amp;version=1" src="/images/search-placeholder-country.png" />}

    tag = cover(pa)
    assert_equal expected_tag, tag
  end

  test '#cover, given a country, returns the image tag for an image of the country' do
    country = FactoryGirl.create(:country, iso: "MBO", name: 'Country')

    expected_tag = %Q{<img alt="Country" data-async="/assets/tiles/#{country.iso}?type=country&amp;version=1" src="/images/search-placeholder-country.png" />}
    tag = cover(country)<commit_msg>Updated image tag expectations<commit_after>require 'test_helper'

class ApplicationHelperTest < ActionView::TestCase
  test '.commaify delimits the given number with commas' do
    assert_equal "22,123,456", commaify(22123456)
    assert_equal "22,123,456", commaify("22123456")
  end

  test '#cover, given a pa, returns an image tag to the asset controller' do
    pa = FactoryGirl.create(:protected_area, name: "Manbone")

    expected_tag = %Q{<img alt="Manbone" class="image" data-src="/assets/tiles/1?type=protected_area&amp;version=1" data-error="/images/search-placeholder-country.png" data-loading="/images/search-placeholder-country.png" src="/images/search-placeholder-country.png" />}

    tag = cover(pa)
    assert_equal expected_tag, tag
  end

  test '#cover, given a country, returns the image tag for an image of the country' do
    country = FactoryGirl.create(:country, iso: "MBO", name: 'Country')

    expected_tag = %Q{<img alt="Country" data-src="/assets/tiles/#{country.iso}?type=country&amp;version=1" data-error="/images/search-placeholder-country.png" data-loading="/images/search-placeholder-country.png" src="/images/search-placeholder-country.png" />}
    tag = cover(country)
{'fraction_non_alphanumeric': 0.13841936957514847, 'fraction_numerical': 0.031521242576518956, 'mean_word_length': 5.083333333333333, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, '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': '3002929', 'n_tokens_mistral': 737, 'n_tokens_neox': 670, 'n_words': 165}