Skip to content

Commit 060fc40

Browse files
committed
return null for undefined relationships
closes #38
1 parent 0145b0e commit 060fc40

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/JSONAPISerializer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -606,7 +606,7 @@ module.exports = class JSONAPISerializer {
606606
serializeRelationship(rType, rData, rOptions, included, extraData) {
607607
// No relationship data
608608
if (rData === undefined) {
609-
return undefined;
609+
return null;
610610
}
611611

612612
// Empty relationship data

test/unit/JSONAPISerializer.test.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -263,9 +263,9 @@ describe('JSONAPISerializer', function() {
263263
},
264264
});
265265

266-
it('should return undefined for an undefined relationship data', function(done) {
266+
it('should return null for an undefined relationship data', function(done) {
267267
const serializedRelationshipData = Serializer.serializeRelationship('articles', undefined);
268-
expect(serializedRelationshipData).to.eql(undefined);
268+
expect(serializedRelationshipData).to.eql(null);
269269
done();
270270
});
271271

0 commit comments

Comments
 (0)