Skip to content

Commit

Permalink
fix: implement multipart progress for node (#252)
Browse files Browse the repository at this point in the history
  • Loading branch information
jeetiss authored Apr 14, 2020
1 parent f5ab80a commit b60eb83
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
9 changes: 8 additions & 1 deletion src/api/multipartUpload.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,5 +37,12 @@ export default function multipartUpload(
data: part,
onProgress,
cancel
}).then(({ status }) => ({ code: status }))
})
.then(result => {
// hack for node ¯\_(ツ)_/¯
if (onProgress) onProgress({ value: 1 })

return result
})
.then(({ status }) => ({ code: status }))
}
6 changes: 0 additions & 6 deletions src/uploadFile/uploadMultipart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,6 @@ const uploadMultipart = (
retryThrottledRequestMaxTimes
})
)
.then(result => {
// hack for node ¯\_(ツ)_/¯
if (onProgress) onProgress({ value: 1 })

return result
})
.then(fileInfo => new UploadcareFile(fileInfo, { baseCDN }))
}

Expand Down
2 changes: 1 addition & 1 deletion test/api/multipartUpload.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ describe('API - multipartUpload', () => {
)
})

xit('should be able to handle progress', async () => {
it('should be able to handle progress', async () => {
const onProgress = jest.fn()
const options = getSettingsForTesting({
publicKey: factory.publicKey('multipart'),
Expand Down

0 comments on commit b60eb83

Please sign in to comment.