<commit_before># frozen_string_literal: true

require 'test_helper'

class ThumbnailsControllerTest < ActionDispatch::IntegrationTest
  setup do
    Link.create(id: 1, url: 'https://fakeimages.com/pic1.jpg', thumbnail_url: 'https://fakeimages.com/pic_thumb1.jpg')
    Link.create(id: 2, url: 'https://fakeimages.com/pic2.jpg', thumbnail_url: 'https://fakeimages.com/pic_thumb2.jpg')
    Link.create(id: 3, url: 'https://fakeimages.com/pic3.jpg', thumbnail_url: 'https://fakeimages.com/pic_thumb3.jpg')
  end

  test 'should retrieve pictures' do
    exp1 = '<img id="1" class="photo col" src="https://fakeimages.com/pic_thumb1.jpg" onclick="selectImage(this);"/>'
    exp2 = '<img id="2" class="photo col" src="https://fakeimages.com/pic_thumb2.jpg" onclick="selectImage(this);"/>'
    exp3 = '<img id="3" class="photo col" src="https://fakeimages.com/pic_thumb3.jpg" onclick="selectImage(this);"/>'

    get t_path

    assert_response :success
    [exp1, exp2, exp3].each { |e| assert_match e, response.body }
  end

  test 'should order retrieved pictures' do
    Link.create(id: 4, url: 'https://fakeimages.com/pic2.jpg', thumbnail_url: 'https://fakeimages.com/pic_thumb4.jpg')
<commit_msg>correcting spurious tests<commit_after># frozen_string_literal: true

require 'test_helper'

class ThumbnailsControllerTest < ActionDispatch::IntegrationTest
  setup do
    Link.create(id: 1, url: 'https://fakeimages.com/pic1.jpg', thumbnail_url: 'https://fakeimages.com/pic_thumb1.jpg')
    Link.create(id: 2, url: 'https://fakeimages.com/pic2.jpg', thumbnail_url: 'https://fakeimages.com/pic_thumb2.jpg')
    Link.create(id: 3, url: 'https://fakeimages.com/pic3.jpg', thumbnail_url: 'https://fakeimages.com/pic_thumb3.jpg')
  end

  test 'should retrieve pictures' do
    exp1 = '<img id="1" class="photo col" src="https://fakeimages.com/pic_thumb1.jpg"/>'
    exp2 = '<img id="2" class="photo col" src="https://fakeimages.com/pic_thumb2.jpg"/>'
    exp3 = '<img id="3" class="photo col" src="https://fakeimages.com/pic_thumb3.jpg"/>'

    get t_path

    assert_response :success
    [exp1, exp2, exp3].each { |e| assert_match e, response.body }
  end

  test 'should order retrieved pictures' do
    Link.create(id: 4, url: 'https://fakeimages.com/pic2.jpg', thumbnail_url: 'https://fakeimages.com/pic_thumb4.jpg')

{'fraction_non_alphanumeric': 0.16774751405101598, 'fraction_numerical': 0.020752269779507133, 'mean_word_length': 4.64390243902439, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 9, 'https://': 22, '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': '5003949', 'n_tokens_mistral': 823, 'n_tokens_neox': 803, 'n_words': 157}