- ProfanityResolver: Updated the
errors
object structure inProfanityResolver
to align with expected test output.- Previously, the error messages included an unnecessary nested object structure with both
isValid
andmessage
properties. - Now, only the
message
string is returned inerrors
when 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
ProfanityResolver
was modified to:- Store only the
message
string for profane fields, improving compatibility with expected test cases. - Populate
errors
directly with themessage
string andtype
, instead of the full result object withisValid
status. - Ensure
validFields
anderrors
correctly separate valid and invalid fields based on profanity checks.
- Store only the
- Updated Tests: Adjusted test cases to validate the refined
errors
object 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.