Skip to content

Commit

Permalink
fix: GEO-1262 - save announcements in which plain text description le…
Browse files Browse the repository at this point in the history
…ngth <= 2000 chars, but rich text is > 2000 chars. (#872)
  • Loading branch information
banders authored Dec 10, 2024
1 parent 2e34150 commit b77d9e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
20 changes: 13 additions & 7 deletions backend/src/v1/routes/announcement-routes.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,13 +425,19 @@ describe('announcement-routes', () => {
mockCreateAnnouncement.mockResolvedValue({
message: 'Announcement created',
});
const response = await request(app).post('/').send({
title: 'Test',
description: 'Test',
expires_on: faker.date.recent(),
active_on: faker.date.future(),
status: 'DRAFT',
});
const response = await request(app)
.post('/')
.send({
title: 'Test',
//long description. this would be rejected by the frontend,
//but should be allowed by the backend (because the backend expects
//some of the characters may be rich text markup, which the system doesn't
//put a limit on
description: '0'.repeat(2001),
expires_on: faker.date.recent(),
active_on: faker.date.future(),
status: 'DRAFT',
});
expect(response.status).toBe(201);
expect(response.body).toEqual({ message: 'Announcement created' });
});
Expand Down
2 changes: 1 addition & 1 deletion backend/src/v1/types/announcements.ts
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ export type PatchAnnouncementsType = z.infer<typeof PatchAnnouncementsSchema>;
export const AnnouncementDataSchema = z
.object({
title: z.string().min(1).max(100),
description: z.string().min(1).max(2000),
description: z.string().min(1),
active_on: z.string().optional(),
expires_on: z.string().optional(),
status: z.enum(['PUBLISHED', 'DRAFT']),
Expand Down

0 comments on commit b77d9e8

Please sign in to comment.