diff --git a/packages/interface-ipfs-core/src/add.js b/packages/interface-ipfs-core/src/add.js index c64fcc1e2b..8d94ded8ff 100644 --- a/packages/interface-ipfs-core/src/add.js +++ b/packages/interface-ipfs-core/src/add.js @@ -233,6 +233,16 @@ module.exports = (factory, options) => { await expect(ipfs.add(nonValid)).to.eventually.be.rejected() }) + it('should fail when passed undefined input', async () => { + // @ts-expect-error undefined is non valid + await expect(ipfs.add(undefined)).to.eventually.be.rejected() + }) + + it('should fail when passed null input', async () => { + // @ts-expect-error null is non valid + await expect(ipfs.add(null)).to.eventually.be.rejected() + }) + it('should wrap content in a directory', async () => { const data = { path: 'testfile.txt', content: fixtures.smallFile.data } diff --git a/packages/interface-ipfs-core/src/pubsub/publish.js b/packages/interface-ipfs-core/src/pubsub/publish.js index 4bcb734906..7f947d5827 100644 --- a/packages/interface-ipfs-core/src/pubsub/publish.js +++ b/packages/interface-ipfs-core/src/pubsub/publish.js @@ -32,8 +32,8 @@ module.exports = (factory, options) => { it('should fail with undefined msg', async () => { const topic = getTopic() - // @ts-ignore invalid parameter - await expect(ipfs.pubsub.publish(topic)).to.eventually.rejectedWith('argument "data" is required') + // @ts-expect-error invalid parameter + await expect(ipfs.pubsub.publish(topic)).to.eventually.be.rejected() }) it('should publish message from buffer', () => { diff --git a/packages/ipfs-core-utils/src/files/normalise-input/normalise-input.js b/packages/ipfs-core-utils/src/files/normalise-input/normalise-input.js index 63362bd207..e584e13563 100644 --- a/packages/ipfs-core-utils/src/files/normalise-input/normalise-input.js +++ b/packages/ipfs-core-utils/src/files/normalise-input/normalise-input.js @@ -28,7 +28,7 @@ const { // eslint-disable-next-line complexity module.exports = async function * normaliseInput (input, normaliseContent) { if (input === null || input === undefined) { - return + throw errCode(new Error(`Unexpected input: ${input}`), 'ERR_UNEXPECTED_INPUT') } // String