File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,21 @@ describe('options.files.test.ts', () => {
3636 assert . equal ( response . data . files . file . size , stat . size ) ;
3737 } ) ;
3838
39+ it ( 'should upload not exists file throw error' , async ( ) => {
40+ const file = path . join ( __dirname , 'cjs' , 'index.js-not-exists' ) ;
41+ await assert . rejects ( async ( ) => {
42+ await urllib . request ( `${ _url } multipart` , {
43+ files : [ file ] ,
44+ dataType : 'json' ,
45+ } ) ;
46+ } , ( err : any ) => {
47+ assert . equal ( err . code , 'ENOENT' ) ;
48+ assert . equal ( err . res . status , - 1 ) ;
49+ assert . equal ( err . status , - 1 ) ;
50+ return true ;
51+ } ) ;
52+ } ) ;
53+
3954 it ( 'should upload files = [filepath] success with default POST method' , async ( ) => {
4055 const file = path . join ( __dirname , 'cjs' , 'index.js' ) ;
4156 const stat = await fs . stat ( file ) ;
You can’t perform that action at this time.
0 commit comments