<commit_before>
var assert = require('assert')

var db = require('..')

describe('mime-db', function () {
  it('should all be mime types', function () {
    assert(Object.keys(db).every(function (name) {
      return ~name.indexOf('/') || console.log(name)
    }))
  })

  it('should not have any uppercased letters in names', function () {
    assert(Object.keys(db).every(function (name) {
      return name === name.toLowerCase()
    }))
  })

  it('should have .json and .js as having UTF-8 charsets', function () {
    assert.equal('UTF-8', db['application/json'].charset)
    assert.equal('UTF-8', db['application/javascript'].charset)
  })

  it('should set audio/x-flac with extension=flac', function () {
    assert.equal('flac', db['audio/x-flac'].extensions[0])
  })

  it('should have guessed application/mathml+xml', function () {
    // because it doesn't have a "template"
    assert(db['application/mathml+xml'])
  })

  it('should not have an empty .extensions', function () {
    assert(Object.keys(db).every(function (name) {
      var mime = db[name]<commit_msg>tests: add test for all types to be in src/<commit_after>
var assert = require('assert')
var fs = require('fs')

var db = require('..')

describe('mime-db', function () {
  it('should not contain types not in src/', function () {
    var path = __dirname + '/../src'
    var types = []

    // collect all source types
    fs.readdirSync(path).forEach(function (file) {
      if (!/^\w+\.json$/.test(file)) return
      types.push.apply(types, Object.keys(require(path + '/' + file)))
    })

    Object.keys(db).forEach(function (name) {
      assert.ok(types.indexOf(name) !== -1, 'type "' + name + '" should be in src/')
    })
  })

  it('should all be mime types', function () {
    assert(Object.keys(db).every(function (name) {
      return ~name.indexOf('/') || console.log(name)
    }))
  })

  it('should not have any uppercased letters in names', function () {
    assert(Object.keys(db).every(function (name) {
      return name === name.toLowerCase()
    }))
  })

  it('should have .json and .js as having UTF-8 charsets', function () {
    assert.equal('UTF-8', db['application/json'].charset)
    assert.equal('UTF-8', db['application/javascript'].charset)
  })

  it('should set audio/x-flac with extension=flac', function () {
    assert.equal('flac', db['audio/x-flac'].extensions[0])
  })

  it('should have guessed application/mathml+xml', function () {
    // because it doesn't have a "template"
    assert(db['application/mathml+xml'])
  })

  it('should not have an empty .extensions', function () {
    assert(Object.keys(db).every(function (name) {
      var mime = db[name]
{'fraction_non_alphanumeric': 0.1800223630264629, 'fraction_numerical': 0.003354453969437197, 'mean_word_length': 3.392798690671031, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, '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': '3894975', 'n_tokens_mistral': 865, 'n_tokens_neox': 839, 'n_words': 207}