restful-goose
Advanced tools
Comparing version 2.0.2 to 2.0.3
@@ -138,3 +138,3 @@ var _ = require('lodash'); | ||
if (Object.keys(relationships).length) { | ||
Object.assign(deserialized, o.relationships); | ||
Object.assign(deserialized, relationships); | ||
} | ||
@@ -141,0 +141,0 @@ |
{ | ||
"name": "restful-goose", | ||
"version": "2.0.2", | ||
"version": "2.0.3", | ||
"description": "A new improved version of your favorite API framework for mongoose/MongoDB", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -91,2 +91,17 @@ var helpers = require('../lib/helpers'); | ||
}); | ||
it('should properly deserialize an object with a one-to-one relationship', function(done) { | ||
connection.model('SubTest').findOne({ parent: { $exists: true }}, {}, {}, function(err, doc) { | ||
var s = helpers.serialize(doc); | ||
var d = helpers.deserialize(s); | ||
expect(d).to.be.a('object'); | ||
expect(d).not.have.property('attributes'); | ||
expect(d).not.have.property('relationships'); | ||
expect(d).to.have.property('name', doc.name); | ||
expect(d.parent).to.be.a('string'); | ||
expect(d.parent).to.equal(doc.parent.toString()); | ||
done(); | ||
}); | ||
}); | ||
}); |
1133733
1972