file-fetch
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -69,3 +69,3 @@ const fs = require('fs') | ||
const stream = new Readable({ read () {} }) | ||
const stream = new Readable() | ||
stream.push(null) | ||
@@ -72,0 +72,0 @@ |
{ | ||
"name": "file-fetch", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"description": "fetch for read and write access to the local file system", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "standard && mocha" | ||
"test": "standard && nyc --reporter=lcov --reporter=text mocha" | ||
}, | ||
@@ -37,4 +37,5 @@ "repository": { | ||
"mocha": "^6.2.2", | ||
"nyc": "^15.0.0", | ||
"standard": "^14.3.1" | ||
} | ||
} |
@@ -173,2 +173,22 @@ const fs = require('fs') | ||
it('should throw an error if the method is PUT, but the "file" is a directory', async () => { | ||
const body = new Readable({ | ||
read: () => { | ||
body.push('test') | ||
body.push(null) | ||
} | ||
}) | ||
const res = await fileFetch('file://' + path.join(__dirname, 'support'), { | ||
method: 'PUT', | ||
body: body | ||
}) | ||
assert.strictEqual(res.status, 500) | ||
return new Promise((resolve) => { | ||
res.body.on('error', resolve) | ||
res.body.resume() | ||
}) | ||
}) | ||
it('should throw an error if the given method is unknown', async () => { | ||
@@ -175,0 +195,0 @@ const res = await fileFetch('file://' + path.join(__dirname, 'support/file.txt'), { |
11731
309
3