@@ -26,7 +26,6 @@ describe('convert function', function () {
2626 console . error ( err ) ;
2727 }
2828 expect ( snippet ) . to . not . be . empty ;
29- fs . writeFileSync ( path . resolve ( __dirname , collectionsPath , './snippet.php' ) , snippet ) ;
3029 } ) ;
3130 done ( ) ;
3231 } ) ;
@@ -181,37 +180,27 @@ describe('getSnippetClient function', function () {
181180
182181describe ( 'getSnippetFooter function' , function ( ) {
183182 it ( 'should return the async version without options' , function ( ) {
184- const expectedString = '$promise = $client->sendAsync($request);\n$promise->then' +
185- '(\n function (ResponseInterface $res) {\n echo $res->getBody();\n },\n ' +
186- ' function (RequestException $e) {\n echo $e->getMessage();\n echo $e->getRequest()->getMethod();\n }\n);\n' ;
183+ const expectedString = '$res = $client->sendAsync($request)->wait();\necho $res->getBody();\n' ;
187184 expect ( getSnippetFooter ( ) ) . to . equal ( expectedString ) ;
188185 } ) ;
189186
190187 it ( 'should return the async version with request options' , function ( ) {
191- const expectedString = '$promise = $client->sendAsync($request, $options);\n$promise->then' +
192- '(\n function (ResponseInterface $res) {\n echo $res->getBody();\n },\n ' +
193- ' function (RequestException $e) {\n echo $e->getMessage();\n echo $e->getRequest()->getMethod();\n }\n);\n' ;
188+ const expectedString = '$res = $client->sendAsync($request, $options)->wait();\necho $res->getBody();\n' ;
194189 expect ( getSnippetFooter ( { } , true ) ) . to . equal ( expectedString ) ;
195190 } ) ;
196191
197192 it ( 'should return the async version with empty options' , function ( ) {
198- const expectedString = '$promise = $client->sendAsync($request);\n$promise->then' +
199- '(\n function (ResponseInterface $res) {\n echo $res->getBody();\n },\n ' +
200- ' function (RequestException $e) {\n echo $e->getMessage();\n echo $e->getRequest()->getMethod();\n }\n);\n' ;
193+ const expectedString = '$res = $client->sendAsync($request)->wait();\necho $res->getBody();\n' ;
201194 expect ( getSnippetFooter ( { } ) ) . to . equal ( expectedString ) ;
202195 } ) ;
203196
204197 it ( 'should return the async version with options as async' , function ( ) {
205- const expectedString = '$promise = $client->sendAsync($request);\n$promise->then' +
206- '(\n function (ResponseInterface $res) {\n echo $res->getBody();\n },\n ' +
207- ' function (RequestException $e) {\n echo $e->getMessage();\n echo $e->getRequest()->getMethod();\n }\n);\n' ;
198+ const expectedString = '$res = $client->sendAsync($request)->wait();\necho $res->getBody();\n' ;
208199 expect ( getSnippetFooter ( { asyncType : 'async' } ) ) . to . equal ( expectedString ) ;
209200 } ) ;
210201
211202 it ( 'should return the async version with options as other string' , function ( ) {
212- const expectedString = '$promise = $client->sendAsync($request);\n$promise->then' +
213- '(\n function (ResponseInterface $res) {\n echo $res->getBody();\n },\n ' +
214- ' function (RequestException $e) {\n echo $e->getMessage();\n echo $e->getRequest()->getMethod();\n }\n);\n' ;
203+ const expectedString = '$res = $client->sendAsync($request)->wait();\necho $res->getBody();\n' ;
215204 expect ( getSnippetFooter ( { asyncType : 'other' } ) ) . to . equal ( expectedString ) ;
216205 } ) ;
217206
0 commit comments