@@ -123,10 +123,14 @@ describe('Options', function () {
123123 id : '1' ,
124124 firstName : 'Sandro' ,
125125 lastName : 'Munda' ,
126+ books : [ { createdAt : '2015-08-04T06:09:24.864Z' } ] ,
127+ address : { zipCode : 42912 }
126128 } ;
127129
128130 var json = new JsonApiSerializer ( 'user' , dataSet , {
129- attributes : [ 'firstName' , 'lastName' ] ,
131+ attributes : [ 'firstName' , 'lastName' , 'books' , 'address' ] ,
132+ books : { attributes : [ 'createdAt' ] } ,
133+ address : { attributes : [ 'zipCode' ] } ,
130134 pluralizeType : false ,
131135 keyForAttribute : function ( attribute ) {
132136 return inflection . underscore ( attribute ) ;
@@ -136,7 +140,14 @@ describe('Options', function () {
136140 expect ( json . data . type ) . equal ( 'user' ) ;
137141 expect ( json . data ) . to . have . property ( 'attributes' ) . that . is
138142 . an ( 'object' )
139- . eql ( { 'first_name' : 'Sandro' , 'last_name' : 'Munda' } ) ;
143+ . eql ( {
144+ 'first_name' : 'Sandro' ,
145+ 'last_name' : 'Munda' ,
146+ books : [ { 'created_at' : '2015-08-04T06:09:24.864Z' } ] ,
147+ address : { 'zip_code' : 42912 }
148+ } ) ;
149+
150+ console . log ( require ( 'util' ) . inspect ( json , { depth : null } ) ) ;
140151
141152 done ( null , json ) ;
142153 } ) ;
@@ -307,8 +318,8 @@ describe('JSON API Serializer', function () {
307318 expect ( json . data [ 0 ] . attributes ) . to . have . property ( 'address' )
308319 . that . is . an ( 'object' )
309320 . eql ( {
310- addressLine1 : '406 Madison Court' ,
311- zipCode : '49426' ,
321+ 'address-line1' : '406 Madison Court' ,
322+ 'zip-code' : '49426' ,
312323 country : 'USA'
313324 } ) ;
314325
0 commit comments