@@ -119,6 +119,45 @@ describe('Subscribers with callback', () => {
119119 } ) ;
120120 } ) ;
121121
122+ describe ( 'batch request URL' , ( ) => {
123+ const payload = {
124+ batches : [ {
125+ subscribers : new Array ( 1 )
126+ } ]
127+ } ;
128+
129+ beforeEach ( ( ) => {
130+ sinon . stub ( request , 'post' )
131+ . yields ( null , { statusCode : 201 } , { } ) ;
132+ spyOn ( request , 'post' ) . and . callThrough ( ) ;
133+ } ) ;
134+
135+ afterEach ( ( ) => {
136+ request . post . restore ( ) ;
137+ } ) ;
138+
139+ it ( 'should set the correct request URL' , ( done ) => {
140+ client . updateBatchSubscribers ( payload , ( errors , responses , bodies ) => {
141+ expect ( errors ) . toBe ( null ) ;
142+ expect ( responses . length ) . toBe ( 1 ) ;
143+ expect ( responses [ 0 ] . statusCode ) . toBe ( 201 ) ;
144+ expect ( bodies ) . toEqual ( [ { } ] ) ;
145+ } ) ;
146+ done ( ) ;
147+
148+ expect ( request . post ) . toHaveBeenCalledWith ( {
149+ url : 'https://api.getdrip.com/v2/9999999/subscribers/batches' ,
150+ headers : client . requestHeaders ( ) ,
151+ json : true ,
152+ body : {
153+ batches : [ {
154+ subscribers : [ undefined ]
155+ } ]
156+ }
157+ } , jasmine . any ( Function ) ) ;
158+ } ) ;
159+ } ) ;
160+
122161 describe ( 'Subscribers with promise' , ( ) => {
123162 const expectedResponse = {
124163 statusCode : 200 ,
0 commit comments