Skip to content

Commit

Permalink
feat: validate uploaded parts before completing upload (#13763)
Browse files Browse the repository at this point in the history
Co-authored-by: Donny Wu <[email protected]>
Co-authored-by: Allan Zheng <[email protected]>
  • Loading branch information
3 people authored Nov 5, 2024
1 parent 4892fe9 commit 4ff7b52
Show file tree
Hide file tree
Showing 8 changed files with 373 additions and 175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,17 @@ describe('uploadData with key', () => {
);
});

it('should NOT throw if data size is unknown', async () => {
uploadData({
key: 'key',
data: {} as any,
});
expect(mockCreateUploadTask).toHaveBeenCalled();
it('should throw if data size is unknown', async () => {
expect(() =>
uploadData({
key: 'key',
data: {} as any,
}),
).toThrow(
expect.objectContaining(
validationErrorMap[StorageValidationErrorCode.InvalidUploadSource],
),
);
});
});

Expand Down Expand Up @@ -166,12 +171,17 @@ describe('uploadData with path', () => {
);
});

it('should NOT throw if data size is unknown', async () => {
uploadData({
path: testPath,
data: {} as any,
});
expect(mockCreateUploadTask).toHaveBeenCalled();
it('should throw if data size is unknown', async () => {
expect(() =>
uploadData({
path: testPath,
data: {} as any,
}),
).toThrow(
expect.objectContaining(
validationErrorMap[StorageValidationErrorCode.InvalidUploadSource],
),
);
});
});

Expand Down
Loading

0 comments on commit 4ff7b52

Please sign in to comment.