Skip to content

Commit

Permalink
TransferManager#downloadFileInChunks test case for failed CRC32C vali…
Browse files Browse the repository at this point in the history
…dation
  • Loading branch information
rhodgkins committed Nov 29, 2023
1 parent 2310d72 commit 8a204ea
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/transfer-manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,19 @@ describe('Transfer Manager', () => {
assert.strictEqual(callCount, 1);
});

it('should throw an error if crc32c validation fails', async () => {
file.download = () => {
return Promise.resolve([Buffer.alloc(0)]) as Promise<DownloadResponse>;
};
CRC32C.fromFile = () => {
return Promise.resolve(new CRC32C(1)); // Set non-expected initial value
};

await assert.rejects(transferManager.downloadFileInChunks(file, { validation: 'crc32c' }), {

Check failure on line 291 in test/transfer-manager.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `transferManager.downloadFileInChunks(file,·{·validation:·'crc32c'·}),` with `⏎········transferManager.downloadFileInChunks(file,·{validation:·'crc32c'}),⏎·······`
code: 'CONTENT_DOWNLOAD_MISMATCH',

Check failure on line 292 in test/transfer-manager.ts

View workflow job for this annotation

GitHub Actions / lint

Insert `··`
})

Check failure on line 293 in test/transfer-manager.ts

View workflow job for this annotation

GitHub Actions / lint

Replace `})` with `··}⏎······);`
});

it('should set the appropriate `GCCL_GCS_CMD_KEY`', async () => {
sandbox.stub(file, 'download').callsFake(async options => {
assert.strictEqual(
Expand Down

0 comments on commit 8a204ea

Please sign in to comment.