<commit_before>const co = require('co')
const expect = require('chai').expect
const validate = require('..')
const Joi = validate.Joi

const next = () => Promise.resolve(true)

describe('koa-joi-schema', () => {

  it('should validate input matching the schema', () => {
    const ctx = {
      body: {
        name: 'Test'
      }
    }
    const validator = validate('body')(Joi.object().keys({
      name: Joi.string()
    }))
    return co(function *() {
      yield validator(ctx, next)
    })
  })

  it('should validate nested input', function *() {
    const ctx = {
      request: {
        body: {
          name: 'Test'
        }
      }<commit_msg>fix: fix joi import on tests<commit_after>const co = require('co')
const expect = require('chai').expect
const validate = require('..')
const Joi = require('joi')

const next = () => Promise.resolve(true)

describe('koa-joi-schema', () => {

  it('should validate input matching the schema', () => {
    const ctx = {
      body: {
        name: 'Test'
      }
    }
    const validator = validate('body')(Joi.object().keys({
      name: Joi.string()
    }))
    return co(function *() {
      yield validator(ctx, next)
    })
  })

  it('should validate nested input', function *() {
    const ctx = {
      request: {
        body: {
          name: 'Test'
        }
      }
{'fraction_non_alphanumeric': 0.16753926701570682, 'fraction_numerical': 0.0, 'mean_word_length': 2.3533834586466167, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '5672527', 'n_tokens_mistral': 427, 'n_tokens_neox': 417, 'n_words': 101}