Refactor: Update FlyerUploader tests to improve job status mocking and enhance clarity in polling logic
All checks were successful
Deploy to Test Environment / deploy-to-test (push) Successful in 12m44s

This commit is contained in:
2025-12-15 22:15:17 -08:00
parent 9f5de1168d
commit e1536e24b9
6 changed files with 40 additions and 57 deletions

View File

@@ -143,11 +143,17 @@ export const ProfileManager: React.FC<ProfileManagerProps> = ({ isOpen, onClose,
// Error is already handled by useApi hook, but we log it for good measure.
logger.error({ err: result.reason }, 'A profile save operation failed:');
} else if (result.status === 'fulfilled') {
// If this was the profile update promise, capture its result.
// We assume the profile promise is always first if it exists.
if (profileDataChanged && index === 0 && result.value) {
updatedProfileData = result.value as Profile;
onProfileUpdate(updatedProfileData);
// useApi returns null if an error occurred but was caught.
// We must treat null results as failures for the purpose of 'allSucceeded'.
if (!result.value) {
allSucceeded = false;
} else {
// If this was the profile update promise, capture its result.
// We assume the profile promise is always first if it exists.
if (profileDataChanged && index === 0) {
updatedProfileData = result.value as Profile;
onProfileUpdate(updatedProfileData);
}
}
}
});