var Schema = require('../lib'),
    expect = require('chai').expect,
    sinon = require('sinon');

describe("Schema", function() {
    describe(".test()", function() {
        it("should call all validators on property", function() {
            var v1 = sinon.stub().returns(true),
                v2 = sinon.stub().returns(true),
                schema = new Schema({
                    'name': {
                        validators: [v1, v2],
                        message: 'Error'
                    }
                });

            void(schema.test({
                'name': 'test'
            }));

            sinon.assert.calledOnce(v1);
            sinon.assert.calledWith(v1, 'test');
            sinon.assert.calledOnce(v2);
            sinon.assert.calledWith(v2, 'test');
        });

        it("should call Schema.test() on all array elements", function() {
            var v = sinon.stub().returns(true),
                subSchema = new Schema({
                    'id': {
                        validators: [v]
                    }
                }),
                schema = new Schema({
                    'array': {
                        validators: [subSchema]
                    }
                });

            void(schema.test({
                'array': [
                    {
                        'id': 'test1'
                    },
                    {
                        'id': 'test2'
                    }
                ]
            }));

            sinon.assert.calledTwice(v);
            sinon.assert.calledWith(v, 'test1');
            sinon.assert.calledWith(v, 'test2');
        });

        it("should call Schema.test() on object member", function() {
            var v = sinon.stub().returns(true),
                subSchema = new Schema({
                    'id': {
                        validators: [v]
                    }
                }),
                schema = new Schema({
                    'obj': {
                        validators: [subSchema]
                    }
                }),
                obj = { 'id': 1 };

            void(schema.test({
                'obj': obj
            }));

            sinon.assert.calledOnce(v);
            sinon.assert.calledWith(v, obj.id);
        });
    });
});

@@ -789,32 +789,1217 @@
 );%0A        %7D);%0A%0A
+        it(%22should return valid if all validators pass%22, function() %7B%0A            var v1 = sinon.stub().returns(true),%0A                v2 = sinon.stub().returns(true),%0A                v3 = sinon.stub().returns(true),%0A                schema = new Schema(%7B%0A                    'foo': %7B%0A                        validators: %5Bv1, v2%5D%0A                    %7D,%0A                    'bar': %7B%0A                        validators: %5Bv3%5D%0A                    %7D%0A                %7D);%0A%0A            var result = schema.test(%7B'foo': true, 'bar': true%7D);%0A%0A            expect(result.valid).to.be.true;%0A        %7D);%0A%0A        it(%22should return invalid if any validators fail%22, function() %7B%0A            var v1 = sinon.stub().returns(true),%0A                v2 = sinon.stub().returns(false),%0A                v3 = sinon.stub().returns(true),%0A                schema = new Schema(%7B%0A                    'foo': %7B%0A                        validators: %5Bv1, v2%5D%0A                    %7D,%0A                    'bar': %7B%0A                        validators: %5Bv3%5D%0A                    %7D%0A                %7D);%0A%0A            var result = schema.test(%7B'foo': true, 'bar': true%7D);%0A%0A            expect(result.valid).to.be.false;%0A        %7D);%0A%0A%0A
         it(%22shou
@@ -3280,16 +3280,52 @@
  = %7B
- 'id': 1
+%0A                    'id': 1%0A               
  %7D;%0A

Add more (basic) tests