mirror of
https://github.com/zkldi/Tachi.git
synced 2026-10-08 14:58:12 +03:00
Permit zero-length strings for about me
This commit is contained in:
@@ -34,7 +34,7 @@ function AboutMeCard({ reqUser }: Props) {
|
||||
headers: {
|
||||
"Content-Type": "application/json",
|
||||
},
|
||||
body: JSON.stringify({ about: content.length === 0 ? null : content }),
|
||||
body: JSON.stringify({ about: content }),
|
||||
},
|
||||
true,
|
||||
true
|
||||
|
||||
@@ -120,6 +120,20 @@ t.test("PATCH /api/v1/users/:userID", async (t) => {
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test("Shouldn't allow empty strings for about me.", async (t) => {
|
||||
const res = await mockApi.patch("/api/v1/users/1").set("Cookie", cookie).send({
|
||||
about: "",
|
||||
});
|
||||
|
||||
t.equal(res.statusCode, 200);
|
||||
|
||||
const dbUser = await db.users.findOne({ id: 1 });
|
||||
|
||||
t.equal(dbUser?.about, "");
|
||||
|
||||
t.end();
|
||||
});
|
||||
|
||||
t.test("Shouldn't allow about me to be set to null.", async (t) => {
|
||||
const res = await mockApi.patch("/api/v1/users/1").set("Cookie", cookie).send({
|
||||
about: null,
|
||||
|
||||
Reference in New Issue
Block a user