File size: 885 Bytes
2fcec7b | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | var should = require('should'),
dino = require('../../');
describe('object', function(){
var type;
beforeEach(function(){
type = Object.create(dino.types.object);
});
describe('parseValue', function(){
it('parses the value', function(){
should.not.exist(type.deserialize());
should.not.exist(type.deserialize(null));
type.deserialize(1).should.equal(1);
should.not.exist(type.deserialize('a'));
});
});
describe('transformValue', function(){
it('transforms the value', function(){
should.not.exist(type.serialize());
should.not.exist(type.serialize(null));
type.serialize(1).should.eql('1');
var obj = { test: 'test' };
type.serialize(obj).should.eql(JSON.stringify(obj));
});
});
}); |