<commit_before>var test = require('tap').test
  , lib = require('./')

test('should work for errors', function(t) {
  t.plan(1)
  var e = new Error('Test')
  helper(e)(function(err) {
    t.equal(err, undefined, 'no error should be passed')
  })
})

test('should fail for primitives', function(t) {
  t.plan(6)
  helper(false)(function(err) {
    t.equal(err instanceof Error, true, 'err should be an error')
    t.equal(err.message, 'Expected Error but got boolean')
  })

  helper(1)(function(err) {
    t.equal(err instanceof Error, true, 'err should be an error')
    t.equal(err.message, 'Expected Error but got number')
  })

  helper('1')(function(err) {
    t.equal(err instanceof Error, true, 'err should be an error')
    t.equal(err.message, 'Expected Error but got string')
  })
})

test('should fail for objects', function(t) {
  helper({})(function(err) {
    t.equal(err instanceof Error, true, 'err should be an error')<commit_msg>test: add test for null<commit_after>var test = require('tap').test
  , lib = require('./')

test('should work for errors', function(t) {
  t.plan(1)
  var e = new Error('Test')
  helper(e)(function(err) {
    t.equal(err, undefined, 'no error should be passed')
  })
})

test('should fail for primitives', function(t) {
  t.plan(8)
  helper(false)(function(err) {
    t.equal(err instanceof Error, true, 'err should be an error')
    t.equal(err.message, 'Expected Error but got boolean')
  })

  helper(1)(function(err) {
    t.equal(err instanceof Error, true, 'err should be an error')
    t.equal(err.message, 'Expected Error but got number')
  })

  helper('1')(function(err) {
    t.equal(err instanceof Error, true, 'err should be an error')
    t.equal(err.message, 'Expected Error but got string')
  })

  helper(null)(function(err) {
    t.equal(err instanceof Error, true, 'err should be an error')
    t.equal(err.message, 'Expected Error but got null')
  })
})

test('should fail for objects', function(t) {
  helper({})(function(err) {
    t.equal(err instanceof Error, true, 'err should be an error')
{'fraction_non_alphanumeric': 0.15753756665050897, 'fraction_numerical': 0.003877847794474067, 'mean_word_length': 3.9734939759036143, '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': '428148', 'n_tokens_mistral': 683, 'n_tokens_neox': 671, 'n_words': 203}