Skip to content

Commit

Permalink
Reword error message and remove min max from validation
Browse files Browse the repository at this point in the history
  • Loading branch information
jamdelion committed Nov 12, 2024
1 parent cbff416 commit 805f030
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ describe("when feedback is required but the user does not submit any data", asyn

it("displays an appropriate error message for each missing field", async () => {
const errorMessages = [
"Please provide a feedback score",
"Please rate your experience",
"Enter your feedback",
];
errorMessages.map((error) => {
Expand Down
11 changes: 2 additions & 9 deletions editor.planx.uk/src/@planx/components/Feedback/model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,7 @@ export const createFeedbackSchema = (feedbackRequired: boolean) => {
? string().required("Enter your feedback")
: string(),
feedbackScore: feedbackRequired
? number()
.integer()
.min(1, "Feedback score must be at least 1")
.max(5, "Feedback score cannot exceed 5")
.required("Please provide a feedback score")
: number()
.integer()
.min(1, "Feedback score must be at least 1")
.max(5, "Feedback score cannot exceed 5"),
? number().integer().required("Please rate your experience")
: number().integer(),
});
};

0 comments on commit 805f030

Please sign in to comment.