<commit_before>require File.expand_path 'test_helper.rb'

class FBAppRoutes < Minitest::Test

  include Rack::Test::Methods

  def app
    FBApp
  end

  $heartbeat = "{\n  \"routes\": [\n    \"/docs\",\n    \"/heartbeat\",\n    \"/mysqlping\",\n    \"/comnames?<params>\",\n    \"/countref?<params>\",\n    \"/country?<params>\",\n    \"/diet?<params>\",\n    \"/ecology?<params>\",\n    \"/ecosystem?<params>\",\n    \"/faoareas/:id?<params>\",\n    \"/faoarref/:id?<params>\",\n    \"/fecundity?<params>\",\n    \"/fooditems?<params>\",\n    \"/genera/:id?<params>\",\n    \"/intrcase?<params>\",\n    \"/maturity?<params>\",\n    \"/morphdat?<params>\",\n    \"/morphmet?<params>\",\n    \"/occurrence?<params>\",\n    \"/oxygen?<params>\",\n    \"/popchar?<params>\",\n    \"/popgrowth?<params>\",\n    \"/poplf?<params>\",\n    \"/popll?<params>\",\n    \"/popqb?<params>\",\n    \"/poplw?<params>\",\n    \"/predats?<params>\",\n    \"/ration?<params>\",\n    \"/refrens?<params>\",\n    \"/reproduc?<params>\",\n    \"/species/:id?<params>\",\n    \"/spawning?<params>\",\n    \"/speed?<params>\",\n    \"/stocks?<params>\",\n    \"/swimming?<params>\",\n    \"/synonyms?<params>\",\n    \"/taxa?<params>\"\n  ]\n}"
  $countref = {"autoctr"=>851, "Stockcode"=>32, "C_Code"=>"428", "SpecCode"=>24, "CountryRefNo"=>188, "AlsoRef"=>nil, "Status"=>"native", "CurrentPresence"=>"present", "Freshwater"=>0, "Brackish"=>1, "Saltwater"=>0, "Comments"=>nil, "Abundance"=>nil, "RefAbundance"=>nil, "Importance"=>"commercial", "RefImportance"=>8984, "ExVesselPrice"=>2454.0215, "Aquaculture"=>"never/rarely", "RefAquaculture"=>nil, "LiveExportOrg"=>0, "LiveExport"=>nil, "RefLiveExport"=>nil, "Game"=>0, "Bait"=>0, "Regulations"=>nil, "RefRegulations"=>nil, "Threatened"=>0, "CountrySubComp"=>0, "Entered"=>2, "DateEntered"=>"1993-11-12 00:00:00 -0800", "Modified"=>1, "DateModified"=>"1999-03-22 00:00:00 -0800", "Expert"=>nil, "DateChecked"=>nil, "TS"=>nil}

  def test_route_root
    get '/'
    assert 302, last_response.status
  end

  def test_route_heartbeat
    get '/heartbeat'
    assert last_response.ok?
    assert_equal $heartbeat, last_response.body
  end

  # $mysqlping =
  def test_route_mysqlping
    get '/mysqlping'
    assert last_response.ok?
    assert_equal true, JSON.parse(last_response.body)['mysql_server_up']
  end

  # $comnames =
  def test_route_comnames
    get '/comnames'
    assert last_response.ok?
    assert_equal 10, JSON.parse(last_response.body)['returned']
  end

  # $countref =
  def test_route_countref
    get '/countref'
    assert last_response.ok?
    assert_equal 10, JSON.parse(last_response.body)['returned']

    get '/countref?SpecCode=24&fields=GrowthCountFresh,ABB'
    assert last_response.ok?
    # JSON.parse(last_response.body)['data']
    # assert_equal $countref, JSON.parse(last_response.body)['data']
  end

  # $country =
  def test_route_country
    get '/country'
    assert last_response.ok?
    # assert_equal $country, last_response.body
  end

  # $diet =
  def test_route_diet
    get '/diet'
    assert last_response.ok?
    # assert_equal $diet, last_response.body
  end

  # $ecology =
  def test_route_ecology
    get '/ecology'
    assert last_response.ok?
    # assert_equal $ecology, last_response.body
  end

  # $ecosystem =
  def test_route_ecosystem
    get '/ecosystem'
    assert last_response.ok?
    # assert_equal $ecosystem, last_response.body
  end

  # $faoareas =
  def test_route_faoareas
    get '/faoareas'
    assert last_response.ok?
    # assert_equal $faoareas, last_response.body
  end

  # $faoarref =
  def test_route_faoarref
    get '/faoarref'
    assert last_response.ok?
    # assert_equal $faoarref, last_response.body
  end

  # $fecundity =
  def test_route_fecundity
    get '/fecundity'
    assert last_response.ok?
    # assert_equal $fecundity, last_response.body
  end

  # $fooditems =
  def test_route_fooditems
    get '/fooditems'
    assert last_response.ok?
    # assert_equal $fooditems, last_response.body
  end

  # $genera =
  def test_route_genera
    get '/genera'
    assert last_response.ok?
    # assert_equal $genera, last_response.body
  end

  # $intrcase =
  def test_route_intrcase
    get '/intrcase'
    assert last_response.ok?
    # assert_equal $intrcase, last_response.body
  end

  # $maturity =
  def test_route_maturity
    get '/maturity'
    assert last_response.ok?
    # assert_equal $maturity, last_response.body
  end

  # $morphdat =<commit_msg>fix to local test for new listfields route<commit_after>require File.expand_path 'test_helper.rb'

class FBAppRoutes < Minitest::Test

  include Rack::Test::Methods

  def app
    FBApp
  end

  $heartbeat = "{\n  \"routes\": [\n    \"/docs\",\n    \"/heartbeat\",\n    \"/mysqlping\",\n    \"/comnames?<params>\",\n    \"/countref?<params>\",\n    \"/country?<params>\",\n    \"/diet?<params>\",\n    \"/ecology?<params>\",\n    \"/ecosystem?<params>\",\n    \"/faoareas/:id?<params>\",\n    \"/faoarref/:id?<params>\",\n    \"/fecundity?<params>\",\n    \"/fooditems?<params>\",\n    \"/genera/:id?<params>\",\n    \"/intrcase?<params>\",\n    \"/listfields?<params>\",\n    \"/maturity?<params>\",\n    \"/morphdat?<params>\",\n    \"/morphmet?<params>\",\n    \"/occurrence?<params>\",\n    \"/oxygen?<params>\",\n    \"/popchar?<params>\",\n    \"/popgrowth?<params>\",\n    \"/poplf?<params>\",\n    \"/popll?<params>\",\n    \"/popqb?<params>\",\n    \"/poplw?<params>\",\n    \"/predats?<params>\",\n    \"/ration?<params>\",\n    \"/refrens?<params>\",\n    \"/reproduc?<params>\",\n    \"/species/:id?<params>\",\n    \"/spawning?<params>\",\n    \"/speed?<params>\",\n    \"/stocks?<params>\",\n    \"/swimming?<params>\",\n    \"/synonyms?<params>\",\n    \"/taxa?<params>\"\n  ]\n}"
  $countref = {"autoctr"=>851, "Stockcode"=>32, "C_Code"=>"428", "SpecCode"=>24, "CountryRefNo"=>188, "AlsoRef"=>nil, "Status"=>"native", "CurrentPresence"=>"present", "Freshwater"=>0, "Brackish"=>1, "Saltwater"=>0, "Comments"=>nil, "Abundance"=>nil, "RefAbundance"=>nil, "Importance"=>"commercial", "RefImportance"=>8984, "ExVesselPrice"=>2454.0215, "Aquaculture"=>"never/rarely", "RefAquaculture"=>nil, "LiveExportOrg"=>0, "LiveExport"=>nil, "RefLiveExport"=>nil, "Game"=>0, "Bait"=>0, "Regulations"=>nil, "RefRegulations"=>nil, "Threatened"=>0, "CountrySubComp"=>0, "Entered"=>2, "DateEntered"=>"1993-11-12 00:00:00 -0800", "Modified"=>1, "DateModified"=>"1999-03-22 00:00:00 -0800", "Expert"=>nil, "DateChecked"=>nil, "TS"=>nil}

  def test_route_root
    get '/'
    assert 302, last_response.status
  end

  def test_route_heartbeat
    get '/heartbeat'
    assert last_response.ok?
    assert_equal $heartbeat, last_response.body
  end

  # $mysqlping =
  def test_route_mysqlping
    get '/mysqlping'
    assert last_response.ok?
    assert_equal true, JSON.parse(last_response.body)['mysql_server_up']
  end

  # $comnames =
  def test_route_comnames
    get '/comnames'
    assert last_response.ok?
    assert_equal 10, JSON.parse(last_response.body)['returned']
  end

  # $countref =
  def test_route_countref
    get '/countref'
    assert last_response.ok?
    assert_equal 10, JSON.parse(last_response.body)['returned']

    get '/countref?SpecCode=24&fields=GrowthCountFresh,ABB'
    assert last_response.ok?
    # JSON.parse(last_response.body)['data']
    # assert_equal $countref, JSON.parse(last_response.body)['data']
  end

  # $country =
  def test_route_country
    get '/country'
    assert last_response.ok?
    # assert_equal $country, last_response.body
  end

  # $diet =
  def test_route_diet
    get '/diet'
    assert last_response.ok?
    # assert_equal $diet, last_response.body
  end

  # $ecology =
  def test_route_ecology
    get '/ecology'
    assert last_response.ok?
    # assert_equal $ecology, last_response.body
  end

  # $ecosystem =
  def test_route_ecosystem
    get '/ecosystem'
    assert last_response.ok?
    # assert_equal $ecosystem, last_response.body
  end

  # $faoareas =
  def test_route_faoareas
    get '/faoareas'
    assert last_response.ok?
    # assert_equal $faoareas, last_response.body
  end

  # $faoarref =
  def test_route_faoarref
    get '/faoarref'
    assert last_response.ok?
    # assert_equal $faoarref, last_response.body
  end

  # $fecundity =
  def test_route_fecundity
    get '/fecundity'
    assert last_response.ok?
    # assert_equal $fecundity, last_response.body
  end

  # $fooditems =
  def test_route_fooditems
    get '/fooditems'
    assert last_response.ok?
    # assert_equal $fooditems, last_response.body
  end

  # $genera =
  def test_route_genera
    get '/genera'
    assert last_response.ok?
    # assert_equal $genera, last_response.body
  end

  # $intrcase =
  def test_route_intrcase
    get '/intrcase'
    assert last_response.ok?
    # assert_equal $intrcase, last_response.body
  end

  # $listfields =
  def test_route_listfields
    get '/listfields'
    assert last_response.ok?
    # assert_equal $listfields, last_response.body
  end

  # $maturity =
  def test_route_maturity
    get '/maturity'
    assert last_response.ok?
    # assert_equal $maturity, last_response.body
  end

  # $morphdat =
{'fraction_non_alphanumeric': 0.18298380962729544, 'fraction_numerical': 0.01738563511898294, 'mean_word_length': 3.529527559055118, 'pattern_counts': {'":': 2, '<': 74, '<?xml version=': 0, '>': 142, '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': '3918207', 'n_tokens_mistral': 3680, 'n_tokens_neox': 3528, 'n_words': 567}