/**
 * Common tools for test
 */
var chance = require('chance').Chance();
var datasets = require('../');
var async = require('async');
var es = require('event-stream');
var fs = require('fs');
var path = require('path');

module.exports.regex = {
  phone: /(\(\d{3}\)\s*)(\d{3})-(\d{4})/,
  exp: /(\d{2})\/(\d{4})/
};

module.exports.generate = function (schema, opts, fn) {
  if(Object.prototype.toString.call(schema) === '[object Object]'){
    return datasets(opts.size, schema).pipe(es.writeArray(fn));
  }

  fs.createReadStream(schema)
    .pipe(datasets(opts.size))
    .pipe(es.writeArray(fn));
};

module.exports.resolveSchemaPath = function (name) {
  return path.resolve('.', 'examples', name);
};

module.exports.sampleAndStrip = function (array, count, fn) {
  var sample = chance.pick(array, count);
  async.each(sample, function (item, callback) {
    item._id = undefined;
    callback();
  }, function (err) {
    if (err)
      throw err;
    fn(sample);
  });
};

@@ -1,37 +1,4 @@
-/**%0A * Common tools for test%0A */%0A
 var 
@@ -36,44 +36,11 @@
 ce()
-;%0Avar datasets = require('../');%0Avar
+,%0A 
  asy
@@ -60,21 +60,19 @@
 'async')
-;%0Avar
+,%0A 
  es = re
@@ -92,21 +92,19 @@
 stream')
-;%0Avar
+,%0A 
  fs = re
@@ -118,13 +118,11 @@
 fs')
-;%0Avar
+,%0A 
  pat
@@ -140,16 +140,75 @@
 ('path')
+,%0A  assert = require('assert'),%0A  datasets = require('../')
 ;%0A%0Amodul
@@ -295,24 +295,24 @@
 %5Cd%7B4%7D)/%0A%7D;%0A%0A
-
 module.expor
@@ -355,16 +355,53 @@
 , fn) %7B%0A
+  assert(opts.size, 'Missing size');%0A
   if(Obj

add an assert