<commit_before>
nikita = require '../../src'
{tags} = require '../test'

return unless tags.api

describe 'options "schema"', ->

  it 'is valid', ->
    nikita
    .call
      a_string: 'a value'
      an_integer: 1
      schema:
        'id': '/SimplePerson'
        'type': 'object'
        'properties':
          'a_string': 'type': 'string'
          'an_integer': 'type': 'integer', 'minimum': 1
    , ({options}) ->
      options.a_string.should.be.a.String()
      options.an_integer.should.be.a.Number()
    .promise()

  it 'is invalid', ->
    nikita
    .call
      a_string: 1
      an_integer: 0
      schema:
        'type': 'object'
        'properties':
          'a_string': 'type': 'string'
          'an_integer': 'type': 'integer', 'minimum': 1
      relax: true
    , (->)
    , (err) ->
      err.message.should.eql 'Invalid Options'<commit_msg>schema: fix warning in test<commit_after>
nikita = require '../../src'
{tags} = require '../test'

return unless tags.api

describe 'options "schema"', ->

  it 'is valid', ->
    nikita
    .call
      a_string: 'a value'
      an_integer: 1
      schema:
        'type': 'object'
        'properties':
          'a_string': 'type': 'string'
          'an_integer': 'type': 'integer', 'minimum': 1
    , ({options}) ->
      options.a_string.should.be.a.String()
      options.an_integer.should.be.a.Number()
    .promise()

  it 'is invalid', ->
    nikita
    .call
      a_string: 1
      an_integer: 0
      schema:
        'type': 'object'
        'properties':
          'a_string': 'type': 'string'
          'an_integer': 'type': 'integer', 'minimum': 1
      relax: true
    , (->)
    , (err) ->
      err.message.should.eql 'Invalid Options'
{'fraction_non_alphanumeric': 0.1713124274099884, 'fraction_numerical': 0.005807200929152149, 'mean_word_length': 1.9913194444444444, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 15, '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': '2752713', 'n_tokens_mistral': 591, 'n_tokens_neox': 568, 'n_words': 137}