File tree Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Expand file tree Collapse file tree 3 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -71,7 +71,7 @@ ApiResource.method = function method(spec) {
71
71
72
72
function provideOptions ( ) {
73
73
if ( ! path ) {
74
- throw new Error ( "A resource mus define 'path'" ) ;
74
+ throw new Error ( "A resource must define 'path'" ) ;
75
75
}
76
76
77
77
if ( spec . path ) {
Original file line number Diff line number Diff line change @@ -21,5 +21,10 @@ module.exports = Resource.extend({
21
21
delete : Resource . method ( {
22
22
method : Resource . DELETE ,
23
23
path : '/{id}'
24
+ } ) ,
25
+
26
+ retrieveStep : Resource . method ( {
27
+ method : Resource . GET ,
28
+ path : '/{id}/steps/{stepId}'
24
29
} )
25
30
} ) ;
Original file line number Diff line number Diff line change @@ -166,4 +166,30 @@ describe('/tasks', function () {
166
166
167
167
} ) ;
168
168
} ) ;
169
+
170
+ describe ( '/{id}/steps' , function ( ) {
171
+ describe ( '/{stepId}' , function ( ) {
172
+ it ( 'should send request successfully' , function ( done ) {
173
+ var response = {
174
+ 'id' : 'step_1' ,
175
+ 'comp_id' : 'comp_1'
176
+ } ;
177
+
178
+ nock ( 'https://api.elastic.io' )
179
+ . get ( '/v1/tasks/54f4be3fe7d5224f91000001/steps/step_1' )
180
+ . basicAuth ( {
181
+ user : 'root' ,
182
+ pass : 'secret'
183
+ } )
184
+ . reply ( 200 , response ) ;
185
+
186
+ tasks . retrieveStep ( '54f4be3fe7d5224f91000001' , 'step_1' )
187
+ . then ( function ( result ) {
188
+ expect ( result ) . toEqual ( response ) ;
189
+ } )
190
+ . then ( done )
191
+ . catch ( done . fail ) ;
192
+ } ) ;
193
+ } ) ;
194
+ } ) ;
169
195
} ) ;
You can’t perform that action at this time.
0 commit comments