Fix can't have no bio

This commit is contained in:
Kalle 2022-05-19 17:34:58 +03:00
parent 125dac42fa
commit dbc0149df3
2 changed files with 7 additions and 3 deletions

View File

@ -27,7 +27,10 @@ const userEditActionSchema = z.object({
)
.nullable()
),
bio: z.preprocess(falsyToNull, z.string().max(USER_BIO_MAX_LENGTH)),
bio: z.preprocess(
falsyToNull,
z.string().max(USER_BIO_MAX_LENGTH).nullable()
),
});
export const action: ActionFunction = async ({ request }) => {

View File

@ -11,7 +11,7 @@ describe("User page", () => {
cy.getCy("edit-page-link").should("not.exist");
});
it.only("edits own profile", function () {
it("edits own profile", function () {
cy.intercept("/u/79237403620945920/edit?_data=routes%2Fu.%24identifier").as(
"editPageData"
);
@ -34,9 +34,10 @@ describe("User page", () => {
cy.contains("Finland");
cy.contains(bio);
// let's also check clearing select is possible
// let's also check that clearing inputs is possible
cy.getCy("edit-page-link").click();
cy.getCy("country-select").select(0);
cy.getCy("bio-textarea").clear();
cy.getCy("submit-button").click();
cy.wait("@editPageData");