fix: Allow user to remove team logo (#7095)

This commit is contained in:
Hemachandar
2024-06-20 05:41:54 +05:30
committed by GitHub
parent a825925a31
commit 2333602f25
3 changed files with 30 additions and 2 deletions

View File

@@ -7,7 +7,7 @@ export const TeamsUpdateSchema = BaseSchema.extend({
/** Team name */
name: z.string().optional(),
/** Avatar URL */
avatarUrl: z.string().optional(),
avatarUrl: z.string().nullish(),
/** The subdomain to access the team */
subdomain: z.string().nullish(),
/** Whether public sharing is enabled */

View File

@@ -56,6 +56,34 @@ describe("#team.update", () => {
expect(body.data.name).toEqual(name);
});
it("should add avatar", async () => {
const team = await buildTeam();
const admin = await buildAdmin({ teamId: team.id });
const res = await server.post("/api/team.update", {
body: {
token: admin.getJwtToken(),
avatarUrl: "https://random-url.com",
},
});
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.data.avatarUrl).toEqual("https://random-url.com");
});
it("should remove avatar", async () => {
const team = await buildTeam({ avatarUrl: "https://random-url.com" });
const admin = await buildAdmin({ teamId: team.id });
const res = await server.post("/api/team.update", {
body: {
token: admin.getJwtToken(),
avatarUrl: null,
},
});
const body = await res.json();
expect(res.status).toEqual(200);
expect(body.data.avatarUrl).toBeNull();
});
it("should not invalidate request if subdomain is sent as null", async () => {
const admin = await buildAdmin();
const res = await server.post("/api/team.update", {