2
0
mirror of https://github.com/tenrok/axios.git synced 2026-05-15 11:59:42 +03:00

Fixed errors when running tests

This commit is contained in:
Jay
2022-03-10 21:25:55 +02:00
parent 80387424e4
commit e52e4dbb57
2 changed files with 12 additions and 7 deletions
+10 -6
View File
@@ -141,7 +141,7 @@ describe('supports http with nodejs', function () {
assert.strictEqual(success, false, 'request should not succeed');
assert.strictEqual(failure, true, 'request should fail');
assert.strictEqual(error.code, 'ECONNABORTED');
assert.strictEqual(error.message, 'oops, timeout');
assert.strictEqual(error.message, 'timeout of 250ms exceeded');
done();
}, 300);
});
@@ -237,6 +237,8 @@ describe('supports http with nodejs', function () {
axios.get('http://localhost:4444/', {
maxRedirects: 3
}).catch(function (error) {
assert.equal(error.code, AxiosError.ERR_FR_TOO_MANY_REDIRECTS);
assert.equal(error.message, 'Maximum number of redirects exceeded');
done();
});
});
@@ -252,11 +254,13 @@ describe('supports http with nodejs', function () {
maxRedirects: 3,
beforeRedirect: function (options) {
if (options.path === '/foo') {
throw new Error('path not allowed');
throw new Error(
'Provided path is not allowed'
);
}
}
}).catch(function (error) {
assert.equal(error.toJSON().message, 'path not allowed')
assert.equal(error.message, 'Provided path is not allowed');
done();
});
});
@@ -1087,7 +1091,7 @@ describe('supports http with nodejs', function () {
setTimeout(function () {
assert.equal(success, false, 'request should not succeed');
assert.equal(failure, true, 'request should fail');
assert.equal(error.message, 'Malformed URL tel:484-695-3408');
assert.equal(error.message, 'Unsupported protocol tel:');
done();
}, 300);
})
@@ -1172,8 +1176,8 @@ describe('supports http with nodejs', function () {
}).finally(function () {
assert.strictEqual(success, false, 'request should not succeed');
assert.strictEqual(failure, true, 'request should fail');
assert.strictEqual(error.code, 'ERR_REQUEST_ABORTED');
assert.strictEqual(error.message, 'error request aborted');
assert.strictEqual(error.code, 'ERR_BAD_RESPONSE');
assert.strictEqual(error.message, 'maxContentLength size of -1 exceeded');
done();
});
});