File tree Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Expand file tree Collapse file tree 1 file changed +27
-0
lines changed Original file line number Diff line number Diff line change @@ -2662,6 +2662,33 @@ describe('JSON API Serializer', function () {
2662
2662
expect ( json . data . relationships . address ) . eql ( { data : null } ) ;
2663
2663
} ) ;
2664
2664
2665
+ it ( 'should not be set when the self and related relationshipLinks return null' , function ( ) {
2666
+ var dataSet = {
2667
+ id : '54735750e16638ba1eee59cb' ,
2668
+ firstName : 'Sandro' ,
2669
+ lastName : 'Munda' ,
2670
+ address : null ,
2671
+ } ;
2672
+
2673
+ var json = new JSONAPISerializer ( 'users' , {
2674
+ attributes : [ 'firstName' , 'lastName' , 'address' ] ,
2675
+ address : {
2676
+ ref : 'id' ,
2677
+ included : false ,
2678
+ relationshipLinks : {
2679
+ self : function ( ) {
2680
+ return null ;
2681
+ } ,
2682
+ related : function ( ) {
2683
+ return null ;
2684
+ }
2685
+ } ,
2686
+ }
2687
+ } ) . serialize ( dataSet ) ;
2688
+
2689
+ expect ( json . data . relationships . address ) . eql ( { data : null } ) ;
2690
+ } ) ;
2691
+
2665
2692
it ( 'should be set when the relationshipLinks returns a self link only' , function ( ) {
2666
2693
var dataSet = {
2667
2694
id : '54735750e16638ba1eee59cb' ,
You can’t perform that action at this time.
0 commit comments