fix(s3): use optional chaining in metadata tests to avoid eval error

When minioCredentials is undefined (no Docker), the describe callback
is still evaluated even though the tests are skipped. Using optional
chaining with fallbacks prevents the TypeError during evaluation.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Ciro Spaciari MacBook
2026-01-16 17:39:28 -08:00
parent 2562c412f2
commit fbec5c0eba

View File

@@ -1677,11 +1677,13 @@ describe.skipIf(!minioCredentials)("Archive with S3", () => {
// Metadata tests - test with MinIO only since it properly supports x-amz-meta-* headers
describe.skipIf(!minioCredentials?.endpoint)("S3 Metadata (x-amz-meta-*)", () => {
// Use optional chaining with fallbacks to avoid evaluation errors when minioCredentials is undefined
// (the describe is skipped in that case, but the callback is still evaluated)
const credentials: S3Options = {
accessKeyId: minioCredentials!.accessKeyId,
secretAccessKey: minioCredentials!.secretAccessKey,
endpoint: minioCredentials!.endpoint,
bucket: minioCredentials!.bucket,
accessKeyId: minioCredentials?.accessKeyId ?? "",
secretAccessKey: minioCredentials?.secretAccessKey ?? "",
endpoint: minioCredentials?.endpoint ?? "",
bucket: minioCredentials?.bucket ?? "",
};
it("should upload and retrieve metadata via S3File.write() and stat()", async () => {