This repository was archived by the owner on Mar 11, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed
Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,35 @@ describe('CloudantClient', function() {
201201 } ) ;
202202 } ) ;
203203
204+ describe ( 'Error Handling' , function ( ) {
205+ it ( 'Propagate request error: Invalid protocol.' , function ( done ) {
206+ var cloudantClient = new Client ( ) ;
207+ cloudantClient . request ( 'abc://localhost:5984' , function ( err ) {
208+ assert . equal ( err . message , 'Invalid protocol: abc:' ) ;
209+ done ( ) ;
210+ } ) ;
211+ } ) ;
212+
213+ it ( 'Propagate request error: Base URL must be type string.' , function ( done ) {
214+ var cloudantClient = new Client ( ) ;
215+ cloudantClient . request ( { baseUrl : 123 , url : '/_all_dbs' } , function ( err ) {
216+ assert . equal ( err . message , 'options.baseUrl must be a string' ) ;
217+ done ( ) ;
218+ } ) ;
219+ } ) ;
220+
221+ it ( 'Propagate request error: `unix://` URL scheme is no longer supported.' , function ( done ) {
222+ var cloudantClient = new Client ( ) ;
223+ cloudantClient . request ( 'unix://abc' , function ( err ) {
224+ assert . equal (
225+ err . message ,
226+ '`unix://` URL scheme is no longer supported. Please use the format `http://unix:SOCKET:PATH`'
227+ ) ;
228+ done ( ) ;
229+ } ) ;
230+ } ) ;
231+ } ) ;
232+
204233 describe ( 'aborts request' , function ( ) {
205234 it ( 'during plugin execution phase' , function ( done ) {
206235 if ( process . env . NOCK_OFF ) {
You can’t perform that action at this time.
0 commit comments