<commit_before>'use strict'

const t = require('tap')
const test = t.test
const FindMyWay = require('../')

test('Method should be a string', t => {
  t.plan(1)
  const findMyWay = FindMyWay()

  try {
    findMyWay.on(0, '/test', () => {})
    t.fail('method shoukd be a string')
  } catch (e) {
    t.is(e.message, 'Method should be a string')
  }
})

test('Method should be a string (array)', t => {
  t.plan(1)
  const findMyWay = FindMyWay()

  try {
    findMyWay.on(['GET', 0], '/test', () => {})
    t.fail('method shoukd be a string')
  } catch (e) {
    t.is(e.message, 'Method should be a string')
  }
})

test('Path should be a string', t => {
  t.plan(1)
  const findMyWay = FindMyWay()

  try {
    findMyWay.on('GET', 0, () => {})
    t.fail('path should be a string')
  } catch (e) {
    t.is(e.message, 'Path should be a string')
  }
})

test('Handler should be a function', t => {
  t.plan(1)
  const findMyWay = FindMyWay()

  try {
    findMyWay.on('GET', '/test', 0)
    t.fail('handler should be a function')
  } catch (e) {
    t.is(e.message, 'Handler should be a function')
  }
})

test('Method is not an http method.', t => {
  t.plan(1)<commit_msg>Updated test<commit_after>'use strict'

const t = require('tap')
const test = t.test
const FindMyWay = require('../')

test('Method should be a string', t => {
  t.plan(1)
  const findMyWay = FindMyWay()

  try {
    findMyWay.on(0, '/test', () => {})
    t.fail('method shoukd be a string')
  } catch (e) {
    t.is(e.message, 'Method should be a string')
  }
})

test('Method should be a string (array)', t => {
  t.plan(1)
  const findMyWay = FindMyWay()

  try {
    findMyWay.on(['GET', 0], '/test', () => {})
    t.fail('method shoukd be a string')
  } catch (e) {
    t.is(e.message, 'Method should be a string')
  }
})

test('Path should be a string', t => {
  t.plan(1)
  const findMyWay = FindMyWay()

  try {
    findMyWay.on('GET', 0, () => {})
    t.fail('path should be a string')
  } catch (e) {
    t.is(e.message, 'Path should be a string')
  }
})

test('The path could not be empty', t => {
  t.plan(1)
  const findMyWay = FindMyWay()

  try {
    findMyWay.on('GET', '', () => {})
    t.fail('The path could not be empty')
  } catch (e) {
    t.is(e.message, 'The path could not be empty')
  }
})

test('The first character of a path should be `/` or `*`', t => {
  t.plan(1)
  const findMyWay = FindMyWay()

  try {
    findMyWay.on('GET', 'a', () => {})
    t.fail('The first character of a path should be `/` or `*`')
  } catch (e) {
    t.is(e.message, 'The first character of a path should be `/` or `*`')
  }
})

test('Handler should be a function', t => {
  t.plan(1)
  const findMyWay = FindMyWay()

  try {
    findMyWay.on('GET', '/test', 0)
    t.fail('handler should be a function')
  } catch (e) {
    t.is(e.message, 'Handler should be a function')
  }
})

test('Method is not an http method.', t => {
  t.plan(1)
{'fraction_non_alphanumeric': 0.1903457719958918, 'fraction_numerical': 0.006846970215679562, 'mean_word_length': 2.8548812664907652, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 23, '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': '5482158', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1109, 'n_words': 318}