- ProfanityResolver: Updated the
errorsobject structure inProfanityResolverto align with expected test output.- Previously, the error messages included an unnecessary nested object structure with both
isValidandmessageproperties. - Now, only the
messagestring is returned inerrorswhen profanity is detected, following the format{ type: "profanity", message: "Content flagged for: badword" }.
- Previously, the error messages included an unnecessary nested object structure with both
- Validation Logic: The
ProfanityResolverwas modified to:- Store only the
messagestring for profane fields, improving compatibility with expected test cases. - Populate
errorsdirectly with themessagestring andtype, instead of the full result object withisValidstatus. - Ensure
validFieldsanderrorscorrectly separate valid and invalid fields based on profanity checks.
- Store only the
- Updated Tests: Adjusted test cases to validate the refined
errorsobject structure, ensuring that the resolved errors output matches expectations.
Note: This change does not impact the overall functionality of ProfanityResolver but improves consistency in output format for better test compatibility.