Only mock the cacheUtil methods we need

This commit is contained in:
John Sudol
2024-11-26 23:05:11 +00:00
parent 208dbe2131
commit 94f18eb26e
2 changed files with 20 additions and 15 deletions

View File

@@ -5,6 +5,7 @@ import {
BlockBlobClient,
BlockBlobParallelUploadOptions
} from '@azure/storage-blob'
import {InvalidResponseError} from '../shared/errors'
export async function uploadCacheFile(
signedUploadURL: string,
@@ -24,5 +25,13 @@ export async function uploadCacheFile(
`BlobClient: ${blobClient.name}:${blobClient.accountName}:${blobClient.containerName}`
)
return blockBlobClient.uploadFile(archivePath, uploadOptions)
const resp = await blockBlobClient.uploadFile(archivePath, uploadOptions)
if (resp._response.status >= 400) {
throw new InvalidResponseError(
`Upload failed with status code: ${resp._response.status}`
)
}
return resp
}