@@ -402,9 +402,6 @@ describe('retrieve_and_rank', function() {
402402
403403 search . deleteRanker ( { } , missingParameter ) ;
404404 search . deleteRanker ( null , missingParameter ) ;
405-
406- search . rank ( { ranker_id : 'ranker1' } , missingParameter ) ;
407- search . rank ( { ranker_id : 'ranker1' , answer_metadata : rankerData } , missingParameter ) ;
408405 } ) ;
409406
410407 it ( 'should generate a valid payload when creating a ranker' , function ( done ) {
@@ -440,4 +437,25 @@ describe('retrieve_and_rank', function() {
440437 } ) ;
441438 } ) ;
442439
440+ describe ( 'rank()' , function ( ) {
441+ it ( 'check missing parameters' , function ( ) {
442+ search . rank ( { ranker_id : 'ranker1' } , missingParameter ) ;
443+ search . rank ( { ranker_id : 'ranker1' , answer_metadata : rankerData } , missingParameter ) ;
444+ } ) ;
445+
446+ it ( 'should support the answers parameter' , function ( done ) {
447+ nock ( service . url )
448+ . post ( rankPath + '/rank' )
449+ . reply ( 200 , rankResponse ) ;
450+ var req = search . rank ( { ranker_id : 'foo' , answers : 3 , answer_data : 'bar' } , function ( err ) {
451+ if ( err ) {
452+ return done ( err ) ;
453+ }
454+ } ) ;
455+ assert . equal ( req . formData . answers , 3 ) ;
456+ done ( ) ;
457+ } ) ;
458+ } ) ;
459+
460+
443461} ) ;
0 commit comments