Add tests for main package, manager, and various components

- Introduced unit tests for the main package to ensure compilation.
- Added tests for the manager, including validation of upload sessions and handling of Blender binary paths.
- Implemented tests for job token generation and validation, ensuring security and integrity.
- Created tests for configuration management and database schema to verify functionality.
- Added tests for logger and runner components to enhance overall test coverage and reliability.
This commit is contained in:
2026-03-14 22:20:03 -05:00
parent 16d6a95058
commit a3defe5cf6
45 changed files with 1717 additions and 52 deletions

View File

@@ -169,11 +169,27 @@
});
const data = await res.json().catch(() => ({}));
if (!res.ok) {
throw new Error(data.error || "Job creation failed");
const err = new Error(data.error || "Job creation failed");
if (data && typeof data.code === "string") {
err.code = data.code;
}
throw err;
}
return data;
}
function resetToUploadStep(message) {
sessionID = "";
clearInterval(pollTimer);
setUploadBusy(false);
mainBlendWrapper.classList.add("hidden");
metadataPreview.innerHTML = "";
configSection.classList.add("hidden");
setStep(1);
showStatus("Please upload the file again.");
showError(message);
}
async function runSubmission(mainBlendFile) {
showError("");
setStep(1);
@@ -277,6 +293,14 @@
showError("");
await submitJobConfig();
} catch (err) {
if (err && err.code === "UPLOAD_SESSION_EXPIRED") {
resetToUploadStep(err.message || "Upload session expired. Please upload the file again.");
return;
}
if (err && err.code === "UPLOAD_SESSION_NOT_READY") {
showError(err.message || "Upload session is still processing. Please wait and try again.");
return;
}
showError(err.message || "Failed to create job");
}
});