<commit_before>'use strict';
var stub    = require('sinon').stub;
var should  = require('should');
var Schema  = require('../../lib/schema');

describe('SchemaService', function() {
  describe('.isValidSchema()', function() {
    it('should be typeof `function`', function() {
      Schema.isValidSchema.should.be.type('function');
    });

    describe('getting invalid parameters', function() {
      it('should throw', function() {
        should(Schema.isValidSchema({})).throw();
      });
    });

    describe('missing required fields in schema', function() {
      it('should throw', function() {
        (function(){
          Schema.isValidSchema({ name: { type:   String  } });
        }).should.throw();
      });
    });

    describe('getting fields as excepted', function() {
      it('should not throw', function() {
        (function(){
          Schema.factory({
            name: { type: String, regex: /^/, expose: false }
          })
        }).should.not.throw();
      });
    });
  });

  describe('.factory()', function() {
    it('should be typeof `function`', function() {
      Schema.factory.should.be.type('function');<commit_msg>test(schema): basis<commit_after>'use strict';
var stub    = require('sinon').stub;
var should  = require('should');
var Schema  = require('../../lib/schema');

describe('SchemaService', function() {
  describe('.isValidSchema()', function() {
    it('should be typeof `function`', function() {
      Schema.isValidSchema.should.be.type('function');
    });

    describe('getting invalid parameters', function() {
      it('should throw', function() {
        should(Schema.isValidSchema({})).throw();
      });
    });

    describe('missing required fields in schema', function() {
      it('should throw', function() {
        (function(){
          Schema.isValidSchema({ name: { type: String  } });
        }).should.throw();

        (function(){
          Schema.isValidSchema({
            name: { regex: /^/, expose: false, fixture: 21, type: String }
          });
        }).should.throw();
      });
    });

    describe('getting fields as excepted', function() {
      it('should not throw', function() {
        (function(){
          Schema.factory({
            name: { type: String, regex: /^/, expose: false }
          })
        }).should.not.throw();
      });
    });
  });

  describe('.factory()', function() {
    it('should be typeof `function`', function() {
      Schema.factory.should.be.type('function');
{'fraction_non_alphanumeric': 0.19022827392871447, 'fraction_numerical': 0.0008009611533840609, 'mean_word_length': 2.6046176046176046, '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': '5153773', 'n_tokens_mistral': 679, 'n_tokens_neox': 672, 'n_words': 151}