<commit_before>local spec = require 'spec.spec'

describe("yo-api", function()
  local yo
  before_each(function()
    yo = spec.middleware("yo-api/yo.lua")
  end)

  describe("when the uri is /", function()
    it("sends an email and a notification", function()
      local request         = spec.request({ method = 'GET', url = '/?username=peter' })
      local next_middleware = spec.next_middleware(function()
        assert.contains(request, { method = 'GET', url = '/?username=peter', headers = {['Content-Type'] = 'application/json'}})
        return {status = 200, body = 'ok'}
      end)

      local response = yo(request, next_middleware)<commit_msg>Adapted yo spec to the new way the requests are handled<commit_after>local spec = require 'spec.spec'

describe("yo-api", function()
  local yo
  before_each(function()
    yo = spec.middleware("yo-api/yo.lua")
  end)

  describe("when the uri is /", function()
    it("sends an email and a notification", function()
      local request         = spec.request({ method = 'GET', url = '/?username=peter' })
      local next_middleware = spec.next_middleware(function()
        assert.contains(request, {
          method = 'GET',
          uri = '/',
          query='username=peter',
          headers = {['Content-Type'] = 'application/json'}
        })
        return {status = 200, body = 'ok'}
      end)

      local response = yo(request, next_middleware)
{'fraction_non_alphanumeric': 0.14556962025316456, 'fraction_numerical': 0.004219409282700422, 'mean_word_length': 2.9859943977591037, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '7222679', 'n_tokens_mistral': 431, 'n_tokens_neox': 417, 'n_words': 113}