<commit_before>require_relative "test_helper"

class InteractiveQueryBuilderTest < Minitest::Test
  def assert_interactive_query(expected_query, *args)
    actual_query = InteractiveQueryBuilder.new(*args).query
    assert_equal expected_query, actual_query, args.to_s
  end

  def test_any
    assert_interactive_query "*:dragon", any: "dragon"
    assert_interactive_query '*:green *:dragon', any: "green dragon"
    assert_interactive_query '*:"green dragon"', any: '"green dragon"'
  end

  def test_title
    assert_interactive_query "dragon", title: "dragon"
    assert_interactive_query 'green dragon', title: "green dragon"
    assert_interactive_query '"green dragon"', title: '"green dragon"'
  end

  def test_type
    assert_interactive_query "t:dragon", type: "dragon"
    assert_interactive_query 't:legendary t:dragon', type: "legendary dragon"
    assert_interactive_query 't:"legendary dragon"', type: '"legendary dragon"'
  end

  def test_oracle
    assert_interactive_query "o:draw", oracle: "draw"
    assert_interactive_query 'o:draw o:three', oracle: "draw three"
    assert_interactive_query 'o:"draw three"', oracle: '"draw three"'
  end

  def test_flavor
    assert_interactive_query "ft:fire", flavor: "fire"
    assert_interactive_query 'ft:on ft:fire', flavor: "on fire"
    assert_interactive_query 'ft:"on fire"', flavor: '"on fire"'
  end

  def test_artist
    assert_interactive_query "a:argyle", artist: "argyle"
    assert_interactive_query 'a:steve a:argyle', artist: "<NAME>"
    assert_interactive_query 'a:"<NAME>"', artist: '"<NAME>"'<commit_msg>Synchronized InteractiveQueryBuilder with AdvancedSearch; not sure if we need to test twice<commit_after>require_relative "test_helper"

class InteractiveQueryBuilderTest < Minitest::Test
  def assert_interactive_query(expected_query, *args)
    actual_query = InteractiveQueryBuilder.new(*args).query
    assert_equal expected_query, actual_query, args.to_s
  end

  def test_name
    assert_interactive_query "dragon", name: "dragon"
    assert_interactive_query 'green dragon', name: "green dragon"
    assert_interactive_query '"green dragon"', name: '"green dragon"'
  end

  def test_type
    assert_interactive_query "t:dragon", type: "dragon"
    assert_interactive_query 't:legendary t:dragon', type: "legendary dragon"
    assert_interactive_query 't:"legendary dragon"', type: '"legendary dragon"'
  end

  def test_oracle
    assert_interactive_query "o:draw", oracle: "draw"
    assert_interactive_query 'o:draw o:three', oracle: "draw three"
    assert_interactive_query 'o:"draw three"', oracle: '"draw three"'
  end

  def test_flavor
    assert_interactive_query "ft:fire", flavor: "fire"
    assert_interactive_query 'ft:on ft:fire', flavor: "on fire"
    assert_interactive_query 'ft:"on fire"', flavor: '"on fire"'
  end

  def test_artist
    assert_interactive_query "a:argyle", artist: "argyle"
    assert_interactive_query 'a:steve a:argyle', artist: "<NAME>"
    assert_interactive_query 'a:"steve argyle"', artist: '"<NAME>"'
{'fraction_non_alphanumeric': 0.1102336294833827, 'fraction_numerical': 0.0, 'mean_word_length': 5.594360086767896, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 8, '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': '5549278', 'n_tokens_mistral': 1004, 'n_tokens_neox': 961, 'n_words': 242}