Commit fc611a78 authored by Jaap Karan Singh's avatar Jaap Karan Singh

Added some basic tests

parent 0d35c2ee
/* jshint node:true */
/* globals describe, it */
'use strict';
var monk = require('monk');
var chai = require('chai');
var expect = chai.expect;
var validator = require(__dirname + '/src').validator;
var db = monk('localhost/test');
var collection = db.get('collection');
describe('#types', function() {
describe('#regexp', function() {
it('should work', function() {
var res = validator.validate(/abc/, { type: 'regexp' });
expect(res.valid).to.be.true;
});
});
describe('#objectid', function() {
it('should work for string representation', function() {
var res = validator.validate('123456789012', { type: 'objectId' });
expect(res.valid).to.be.true;
});
it('should work for hex representation', function() {
var res = validator.validate('123456789012345678901234', { type: 'objectId' });
expect(res.valid).to.be.true;
});
it('should work for objectid instance', function() {
var res = validator.validate(collection.id(), { type: 'objectId' });
expect(res.valid).to.be.true;
});
});
});
describe('#attributes', function() {});
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment