@@ -111,7 +111,7 @@ describe('Server', function () {
111111 } )
112112 } )
113113
114- describe ( 'GET /:resource?sort =' , function ( ) {
114+ describe ( 'GET /:resource?_sort =' , function ( ) {
115115 it ( 'should respond with json and sort on a field' , function ( done ) {
116116 request ( server )
117117 . get ( '/tags?_sort=body' )
@@ -200,6 +200,31 @@ describe('Server', function () {
200200 } )
201201 } )
202202
203+ describe ( 'GET /:resource/:id?_embed=' , function ( ) {
204+ it ( 'should respond with corresponding resource and embedded other resource' , function ( done ) {
205+ var posts = db . posts [ 0 ]
206+ posts . comments = [ db . comments [ 0 ] , db . comments [ 1 ] ]
207+ request ( server )
208+ . get ( '/posts/1?_embed=comments' )
209+ . expect ( 'Content-Type' , / j s o n / )
210+ . expect ( posts )
211+ . expect ( 200 , done )
212+ } )
213+ } )
214+
215+ describe ( 'GET /:resource/:id?_embed=&_embed=' , function ( ) {
216+ it ( 'should respond with corresponding resource and embedded other resources' , function ( done ) {
217+ var posts = db . posts [ 0 ]
218+ posts . comments = [ db . comments [ 0 ] , db . comments [ 1 ] ]
219+ posts . refs = [ db . refs [ 0 ] ]
220+ request ( server )
221+ . get ( '/posts/1?_embed=comments&_embed=refs' )
222+ . expect ( 'Content-Type' , / j s o n / )
223+ . expect ( posts )
224+ . expect ( 200 , done )
225+ } )
226+ } )
227+
203228 describe ( 'POST /:resource' , function ( ) {
204229 it ( 'should respond with json, create a resource and increment id' ,
205230 function ( done ) {
0 commit comments