Support comment updates and multipart post uploads

هذا الالتزام موجود في:
2026-05-16 01:54:52 +03:00
الأصل 160bb27a59
التزام 045c74014c
11 ملفات معدلة مع 534 إضافات و48 حذوفات

عرض الملف

@@ -66,6 +66,7 @@ describe('Oudelaa smoke (e2e)', () => {
secondRefreshToken: '',
};
let postId = '';
let editableCommentId = '';
beforeAll(async () => {
const moduleFixture: TestingModule = await Test.createTestingModule({
@@ -270,6 +271,57 @@ describe('Oudelaa smoke (e2e)', () => {
expect(mention).toBeTruthy();
});
it('updates own comment content and mention usernames', async () => {
const createResponse = await request(app.getHttpServer())
.post('/api/v1/comments')
.set('Authorization', `Bearer ${secondary.accessToken}`)
.send({
postId,
content: 'Needs edit',
})
.expect(201);
editableCommentId = createResponse.body._id || createResponse.body.id;
const updatedContent = `Edited with @${primary.username}`;
const updateResponse = await request(app.getHttpServer())
.patch(`/api/v1/comments/${editableCommentId}`)
.set('Authorization', `Bearer ${secondary.accessToken}`)
.send({
content: updatedContent,
mentionUsernames: [primary.username],
})
.expect(200);
expect(updateResponse.body.content).toBe(updatedContent);
expect(updateResponse.body.mentionUsernames).toContain(primary.username.toLowerCase());
const commentsResponse = await request(app.getHttpServer())
.get(`/api/v1/comments/post/${postId}?page=1&limit=20`)
.set('Authorization', `Bearer ${primary.accessToken}`)
.expect(200);
const updatedComment = (commentsResponse.body.items ?? []).find(
(item: any) => (item._id || item.id) === editableCommentId,
);
expect(updatedComment?.content).toBe(updatedContent);
const notificationsResponse = await request(app.getHttpServer())
.get('/api/v1/notifications?resourceType=comment')
.set('Authorization', `Bearer ${primary.accessToken}`)
.expect(200);
const mention = (notificationsResponse.body.items ?? []).find(
(item: any) =>
item.type === 'mention' &&
item.resourceType === 'comment' &&
item.previewText === updatedContent,
);
expect(mention).toBeTruthy();
});
it('supports superadmin sessions refresh rotation and notifications access', async () => {
const loginOne = await request(app.getHttpServer())
.post('/api/v1/auth/superadmin/login')