readding the files that I deleted in the last commit
This commit is contained in:
40
test/serializers/json.test.js!
Executable file
40
test/serializers/json.test.js!
Executable 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'
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
Reference in New Issue
Block a user