Skip to content

Commit 12c7b22

Browse files
committed
f
1 parent 0eea26a commit 12c7b22

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

test/options.files.test.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff 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);

0 commit comments

Comments
 (0)