@@ -153,20 +153,32 @@ describe('Custom targets', function () {
153153
154154 it ( "should throw if the client's target does not exist" , function ( ) {
155155 ( function ( ) {
156- HTTPSnippet . addTargetClient ( 'node.js' , 'axios' , customClient )
156+ HTTPSnippet . addTargetClient ( 'node.js' , customClient )
157+ } ) . should . throw ( Error )
158+ } )
159+
160+ it ( 'should throw if the client does has no info object' , function ( ) {
161+ ( function ( ) {
162+ HTTPSnippet . addTargetClient ( 'node' , { } )
163+ } ) . should . throw ( Error )
164+ } )
165+
166+ it ( 'should throw if the target does not have a properly constructed info object' , function ( ) {
167+ ( function ( ) {
168+ HTTPSnippet . addTargetClient ( 'node' , { info : { key : '' } } )
157169 } ) . should . throw ( Error )
158170 } )
159171
160172 it ( 'should add and convert for a new custom client target' , function ( ) {
161- HTTPSnippet . addTargetClient ( 'node' , 'axios' , customClient )
173+ HTTPSnippet . addTargetClient ( 'node' , customClient )
162174
163175 const target = HTTPSnippet . availableTargets ( ) . find ( function ( target ) { return target . key === 'node' } )
164- const client = target . clients . find ( function ( client ) { return client . key === 'axios' } )
176+ const client = target . clients . find ( function ( client ) { return client . key === customClient . info . key } )
165177 client . should . be . an . Object ( )
166178
167179 Object . keys ( fixtures . requests ) . filter ( clearInfo ) . forEach ( function ( request ) {
168180 // Re-using the `request` module fixtures and framework since we copied it to create a custom client target.
169- itShouldGenerateOutput ( request , 'node/request/' , 'node' , 'axios' )
181+ itShouldGenerateOutput ( request , 'node/request/' , 'node' , customClient . info . key )
170182 } )
171183 } )
172184 } )
0 commit comments