@@ -176,42 +176,42 @@ describe('ServiceObject', () => {
176176 serviceObject . create ( options , done ) ;
177177 } ) ;
178178
179- it ( 'should not change id ' , done => {
179+ it ( 'should not require options ' , done => {
180180 const config = extend ( { } , CONFIG , {
181181 createMethod,
182182 } ) ;
183- const options = { } ;
184183
185- function createMethod (
186- id : string ,
187- options_ : { } ,
188- callback : ( err : Error | null , a : { } , b : { } ) => void
189- ) {
184+ function createMethod ( id : string , options : Function , callback : Function ) {
190185 assert . strictEqual ( id , config . id ) ;
191- assert . strictEqual ( options_ , options ) ;
192- callback ( null , { metadata : { id : 14 } } , { } ) ;
186+ assert . strictEqual ( typeof options , 'function' ) ;
187+ assert . strictEqual ( callback , undefined ) ;
188+ options ( null , { } , { } ) ; // calls done()
193189 }
194190
195191 const serviceObject = new ServiceObject ( config ) ;
196- serviceObject . create ( options ) ;
197- assert . notStrictEqual ( serviceObject . id , 14 ) ;
198- done ( ) ;
192+ serviceObject . create ( done ) ;
199193 } ) ;
200194
201- it ( 'should not require options ' , done => {
195+ it ( 'should update id with metadata id ' , done => {
202196 const config = extend ( { } , CONFIG , {
203197 createMethod,
204198 } ) ;
199+ const options = { } ;
205200
206- function createMethod ( id : string , options : Function , callback : Function ) {
201+ function createMethod (
202+ id : string ,
203+ options_ : { } ,
204+ callback : ( err : Error | null , a : { } , b : { } ) => void
205+ ) {
207206 assert . strictEqual ( id , config . id ) ;
208- assert . strictEqual ( typeof options , 'function' ) ;
209- assert . strictEqual ( callback , undefined ) ;
210- options ( null , { } , { } ) ; // calls done()
207+ assert . strictEqual ( options_ , options ) ;
208+ callback ( null , { metadata : { id : 14 } } , { } ) ;
211209 }
212210
213211 const serviceObject = new ServiceObject ( config ) ;
214- serviceObject . create ( done ) ;
212+ serviceObject . create ( options ) ;
213+ assert . strictEqual ( serviceObject . id , 14 ) ;
214+ done ( ) ;
215215 } ) ;
216216
217217 it ( 'should pass error to callback' , done => {
0 commit comments