<commit_before>require_relative 'spec_helper'
require 'json'

describe 'Getting the root of the service' do
  it 'Should return ok' do
    get '/'
    last_response.must_be :ok?
    last_response.body.must_match(/Weatherscout service/i)
  end
end

describe 'Look up the weather today' do
  it 'Should return ok' do
    header = { 'CONTENT_TYPE' => 'application/json' }
    body = {
      city: '新竹'
    }

    post '/api/v1/daily_weather', body.to_json, header
    last_response.must_be :ok?
  end
end<commit_msg>add negative test<commit_after>require_relative 'spec_helper'
require 'json'

describe 'Getting the root of the service' do
  it 'Should return ok' do
    get '/'
    last_response.must_be :ok?
    last_response.body.must_match(/Weatherscout service/i)
  end
end

describe 'Look up the weather today' do
  it 'Should return ok' do
    header = { 'CONTENT_TYPE' => 'application/json' }
    body = {
      city: '新竹'
    }

    post '/api/v1/daily_weather', body.to_json, header
    last_response.must_be :ok?
  end

  it 'Should return 404 for unknown city (not major city)' do
    header = { 'CONTENT_TYPE' => 'application/json' }
    body = {
      city: '台東市'
    }

    post '/api/v1/daily_weather', body.to_json, header
    last_response.must_be :not_found?
  end

  it 'Should return 400 for bad json format' do
    header = { 'CONTENT_TYPE' => 'application/json' }
    body = "blah blah"

    post '/api/v1/daily_weather', body.to_json, header
    last_response.must_be :bad_request?
  end
end
{'fraction_non_alphanumeric': 0.10912698412698413, 'fraction_numerical': 0.006613756613756613, 'mean_word_length': 3.168044077134986, 'pattern_counts': {'":': 0, '<': 3, '<?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': '1019793', 'n_tokens_mistral': 543, 'n_tokens_neox': 521, 'n_words': 147}