This repository was archived by the owner on Feb 12, 2024. It is now read-only.
File tree 2 files changed +11
-1
lines changed
ipfs-core-utils/src/files/normalise-input
2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -233,6 +233,16 @@ module.exports = (factory, options) => {
233
233
await expect ( ipfs . add ( nonValid ) ) . to . eventually . be . rejected ( )
234
234
} )
235
235
236
+ it ( 'should fail when passed undefined input' , async ( ) => {
237
+ // @ts -expect-error undefined is non valid
238
+ await expect ( ipfs . add ( undefined ) ) . to . eventually . be . rejected ( )
239
+ } )
240
+
241
+ it ( 'should fail when passed null input' , async ( ) => {
242
+ // @ts -expect-error null is non valid
243
+ await expect ( ipfs . add ( null ) ) . to . eventually . be . rejected ( )
244
+ } )
245
+
236
246
it ( 'should wrap content in a directory' , async ( ) => {
237
247
const data = { path : 'testfile.txt' , content : fixtures . smallFile . data }
238
248
Original file line number Diff line number Diff line change @@ -28,7 +28,7 @@ const {
28
28
// eslint-disable-next-line complexity
29
29
module . exports = async function * normaliseInput ( input , normaliseContent ) {
30
30
if ( input === null || input === undefined ) {
31
- return
31
+ throw errCode ( new Error ( `Unexpected input: ${ input } ` ) , 'ERR_UNEXPECTED_INPUT' )
32
32
}
33
33
34
34
// String
You can’t perform that action at this time.
0 commit comments