2
0
mirror of https://github.com/tenrok/axios.git synced 2026-06-11 18:02:32 +03:00

fix(adapter): fix progress event emitting; (#6518)

This commit is contained in:
Dmitriy Mozgovoy
2024-08-01 16:59:58 +03:00
committed by GitHub
parent 85d4d0ea0a
commit e3c76fc9bd
10 changed files with 205 additions and 152 deletions
+6 -1
View File
@@ -1919,6 +1919,7 @@ describe('supports http with nodejs', function () {
describe('progress', function () {
describe('upload', function () {
it('should support upload progress capturing', async function () {
this.timeout(15000);
server = await startHTTPServer({
rate: 100 * 1024
});
@@ -1943,6 +1944,7 @@ describe('supports http with nodejs', function () {
const {data} = await axios.post(LOCAL_SERVER_URL, readable, {
onUploadProgress: ({loaded, total, progress, bytes, upload}) => {
console.log('onUploadProgress', loaded, '/', total);
samples.push({
loaded,
total,
@@ -1975,6 +1977,8 @@ describe('supports http with nodejs', function () {
describe('download', function () {
it('should support download progress capturing', async function () {
this.timeout(15000);
server = await startHTTPServer({
rate: 100 * 1024
});
@@ -1999,6 +2003,7 @@ describe('supports http with nodejs', function () {
const {data} = await axios.post(LOCAL_SERVER_URL, readable, {
onDownloadProgress: ({loaded, total, progress, bytes, download}) => {
console.log('onDownloadProgress', loaded, '/', total);
samples.push({
loaded,
total,
@@ -2114,7 +2119,7 @@ describe('supports http with nodejs', function () {
}]`
);
const progressTicksRate = 2;
const progressTicksRate = 3;
const expectedProgress = ((i + skip) / secs) / progressTicksRate;
assert.ok(