<commit_before>import test from 'tape'
import moment from 'moment'
import _ from 'lodash'
import Entry from '../entry'

import { filterTags } from '../query'
import { hashTags } from '../query'
import { parseDateRange } from '../query'
import { groupEntries } from '../query'
import Query from '../query'

var fakeDb = {
  query: function () {
    let p = new Promise().resolve([])
    return p 
  } 
}

test('new Query requires a db', t => {

  function makeQueryWithoutDb () {
    return new Query() 
  }

  t.plan(1)
  t.throws(makeQueryWithoutDb, 'Query requires a db')
})<commit_msg>test passing a db to query does not throw error<commit_after>import test from 'tape'
import moment from 'moment'
import _ from 'lodash'
import Entry from '../entry'

import { filterTags } from '../query'
import { hashTags } from '../query'
import { parseDateRange } from '../query'
import { groupEntries } from '../query'
import Query from '../query'

var fakeDb = {
  query: function () {
    let p = new Promise().resolve([])
    return p 
  } 
}

test('new Query requires a db', t => {

  function makeQueryWithoutDb () {
    return new Query() 
  }

  function makeQueryWithDb() {
    return new Query(fakeDb) 
  }

  t.plan(2)
  t.throws(makeQueryWithoutDb, 'Query requires a db')
  t.doesNotThrow(makeQueryWithDb, 'Query requires a db')
})
{'fraction_non_alphanumeric': 0.13953488372093023, 'fraction_numerical': 0.0015003750937734434, 'mean_word_length': 3.3452768729641695, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '884457', 'n_tokens_mistral': 420, 'n_tokens_neox': 407, 'n_words': 143}