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 () {
26622662 expect ( json . data . relationships . address ) . eql ( { data : null } ) ;
26632663 } ) ;
26642664
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+
26652692 it ( 'should be set when the relationshipLinks returns a self link only' , function ( ) {
26662693 var dataSet = {
26672694 id : '54735750e16638ba1eee59cb' ,
You can’t perform that action at this time.
0 commit comments