<commit_before><commit_msg>Add test for favicon middleware<commit_after>require('../helper')

describe('Favicon middleware', function(){
  var app
  beforeEach(function() {
    app = starweb()
    app.on('error', function(err) {
      console.log(err.stack)
    })
  })

  it('serves default favicon', function(done) {
    app.use(app.favicon())
    request(app.run())
      .get('/favicon.ico')
      .expect(200)
      .expect('Content-Type', 'image/x-icon')
      .end(done)
  })

  it('ignores non-favicon request', function(done) {
    app.use(app.favicon())
    app.use(function *(next) {
      this.body = 'whatever'
      yield next
    })
    request(app.run())
      .get('/notfavicon')
      .expect(200, 'whatever')
      .expect('Content-Type', 'text/plain')
      .end(done)
  })

  it('serves custom favicon', function(done) {
    app.use(app.favicon('notexist'))
    request(app.run())
      .get('/favicon.ico')
      .expect(404)
      .end(done)
  })
})
{'fraction_non_alphanumeric': 0.18724279835390947, 'fraction_numerical': 0.009259259259259259, 'mean_word_length': 2.7713178294573644, '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': '5079598', 'n_tokens_mistral': 355, 'n_tokens_neox': 335, 'n_words': 54}