fixed some case-related issues

This commit is contained in:
Spencer Alger
2013-10-24 11:43:09 -07:00
parent 6ae5c30b2e
commit b139314abf
6 changed files with 43 additions and 12 deletions

View File

@ -0,0 +1,40 @@
/* JSON Serializer tests */
var JsonSerializer = require('../../src/lib/serializers/Json');
describe('json serializer', function () {
var json;
beforeEach(function () {
json = new JsonSerializer();
});
it('creates simple json strings', function () {
json.serialize({foo: true}).should.eql('{"foo":true}');
});
it('creates pretty json strings', function () {
json.serialize({foo: true, bake: 'cake', 'with': ['bacon']}, null, ' ')
.should.eql(['{',
' "foo": true,',
' "bake": "cake",',
' "with": [',
' "bacon"',
' ]',
'}'].join('\n'));
});
it('reads simple json strings', function () {
json.unserialize('{"foo":true}').should.eql({ foo: true });
});
it('does not create date objects', function () {
json
.unserialize('{"date":"2012-04-23T18:25:43.511Z"}')
.should.eql({
date: '2012-04-23T18:25:43.511Z'
});
});
});