'use strict';

var expect = require('chai').expect,
	checks = requireLib('registry')().checks;

describe('Other validation checks:', function() {

	describe('mongo objectId validation', function() {

		it('should pass', function() {
			var result = checks.isMongoObjectId('507f191e810c19729de860ea');
			expect(result).to.be.true;
		});

		it('should not pass', function() {
			var result = checks.isMongoObjectId('xxxx');
			expect(result).to.be.false;
		});

	});

	describe('is not null validation', function() {

		it('should not pass with null', function() {
	        var result = checks.isNotNull(null);
			expect(result).to.be.false;
	    });

		it('should pass with value', function() {
			var result = checks.isNotNull(1);
			expect(result).to.be.true;
		});
	});

	describe('is not undefined validation', function() {

		it('should not pass with undefined', function() {
			var result = checks.isNotUndefined(undefined);
			expect(result).to.be.false;
		});

		it('should pass with value', function() {
			var result = checks.isNotUndefined(1);
			expect(result).to.be.true;
		});
	});

	describe('is not null or undefined validation', function() {

		it('should not pass with undefined', function() {
			var result = checks.isNotNullOrUndefined(undefined);
			expect(result).to.be.false;
		});

		it('should not pass with null', function() {
			var result = checks.isNotNullOrUndefined(null);
			expect(result).to.be.false;
		});

		it('should pass with value', function() {
			var result = checks.isNotNullOrUndefined(1);
			expect(result).to.be.true;
		});
	});

	describe('empty validation', function() {

		it('should pass with null', function() {
			var result = checks.isEmpty(null);
			expect(result).to.be.true;
		});

		it('should pass with undefined', function() {
			var result = checks.isEmpty(undefined);
			expect(result).to.be.true;
		});

		it('should pass with empty string', function() {
			var result = checks.isEmpty('');
			expect(result).to.be.true;
		});

	});

	describe('custom validation', function() {

		it('should pass with custom validation', function() {
			var result = checks.passes(123, function(value) {
				return !!value;
			});
			expect(result).to.be.true;
		});

		it('should not pass with custom validation', function() {
			var result = checks.passes(123, function(value) {
				return !value;
			});
			expect(result).to.be.false;
		});

	});

});

@@ -558,20 +558,17 @@
 on() %7B%0A%09
-    
+%09
     var 
@@ -750,32 +750,33 @@
 .be.true;%0A%09%09%7D);%0A
+%0A
 %09%7D);%0A%0A%09describe(
@@ -1074,32 +1074,33 @@
 .be.true;%0A%09%09%7D);%0A
+%0A
 %09%7D);%0A%0A%09describe(
@@ -1556,22 +1556,23 @@
 e.true;%0A
-
 %09%09%7D);%0A
+%0A
 %09%7D);%0A%0A%09d

Resolve spacing issues.