diff --git a/apps/dokploy/__test__/volume-backups/volume-backup.real.test.ts b/apps/dokploy/__test__/volume-backups/volume-backup.real.test.ts index e33ee47b7..c7ecbe1af 100644 --- a/apps/dokploy/__test__/volume-backups/volume-backup.real.test.ts +++ b/apps/dokploy/__test__/volume-backups/volume-backup.real.test.ts @@ -46,10 +46,7 @@ const createMockDestination = () => ({ endpoint: "s3.amazonaws.com", }); -const createMockVolumeBackup = ( - volumeName: string, - appName: string, -): Partial => ({ +const createMockVolumeBackup = (volumeName: string, appName: string): any => ({ volumeBackupId: "id", name: "Test", volumeName, @@ -241,10 +238,11 @@ describe( // Extract and execute just the backup part of the command (tar creation) // This is what Dokploy really does - const commandWithoutS3 = fullCommand.replace( - /rclone copyto[^\n]+/g, - 'echo "Skipping S3 upload - keeping file locally for test"', - ); + const commandWithoutS3 = + fullCommand?.replace( + /rclone copyto[^\n]+/g, + 'echo "Skipping S3 upload - keeping file locally for test"', + ) || ""; // Also prevent the cleanup of the backup file so we can verify it const commandWithoutCleanup = commandWithoutS3.replace( @@ -274,6 +272,10 @@ describe( ); const backupFilePath = backupFiles.trim().split("\n")[0]; + if (!backupFilePath) { + throw new Error("No backup file found"); + } + expect(existsSync(backupFilePath)).toBe(true); console.log(`✅ Backup file created: ${path.basename(backupFilePath)}`);