File tree 1 file changed +17
-0
lines changed
1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -152,6 +152,23 @@ describe("basic usage", function() {
152
152
} ) ;
153
153
154
154
155
+ it ( 'should not throw if response.data is the resource object' , function ( ) {
156
+ var data = { id :{ key :123 } , number :'9876' } ;
157
+ $httpBackend . expect ( 'GET' , '/CreditCard/123' ) . respond ( data ) ;
158
+
159
+ var cc = CreditCard . get ( { id :123 } ) ;
160
+ $httpBackend . flush ( ) ;
161
+ expect ( cc instanceof CreditCard ) . toBe ( true ) ;
162
+
163
+ $httpBackend . expect ( 'POST' , '/CreditCard/123' , angular . toJson ( data ) ) . respond ( cc ) ;
164
+
165
+ cc . $save ( ) ;
166
+ $httpBackend . flush ( ) ;
167
+ expect ( cc . id ) . toEqual ( { key :123 } ) ;
168
+ expect ( cc . number ) . toEqual ( '9876' ) ;
169
+ } ) ;
170
+
171
+
155
172
it ( 'should default to empty parameters' , function ( ) {
156
173
$httpBackend . expect ( 'GET' , 'URL' ) . respond ( { } ) ;
157
174
$resource ( 'URL' ) . query ( ) ;
You can’t perform that action at this time.
0 commit comments