This repository has been archived on 2020-11-15. You can view files and clone it, but cannot push or open issues or pull requests.
schemajs/test/default.js

20 lines
488 B
JavaScript
Raw Normal View History

2012-05-28 00:35:58 +00:00
describe("default schemas", function()
2011-11-16 17:51:23 +00:00
{
2012-09-10 11:26:31 +00:00
var schemajs = require('../schema');
var expect = require('chai').expect;
2011-11-16 17:51:23 +00:00
2012-05-28 00:35:58 +00:00
it("default values", function()
{
var schema = schemajs.create(
{
sound: {type:'string', 'default':'mooo'}
});
2011-11-16 17:51:23 +00:00
2012-05-28 00:35:58 +00:00
var input1 = schema.validate({sound: 'meow'});
var input2 = schema.validate({});
expect(input1.data.sound).to.equal("meow");
expect(input2.data.sound).to.equal("mooo");
});
2011-11-16 17:51:23 +00:00
});