Skip to content

Commit ee2dc5c

Browse files
sampaiodiegoclaude
andcommitted
test: remove redundant schema validation tests from moderation
Remove 9 tests that only validated schema rejection (empty userId/msgId/ reportId, missing description) for endpoints now using the new API.v1.get/post pattern with AJV-compiled validators. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e1e4f79 commit ee2dc5c

File tree

1 file changed

+0
-140
lines changed

1 file changed

+0
-140
lines changed

apps/meteor/tests/end-to-end/api/moderation.ts

Lines changed: 0 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -248,22 +248,6 @@ describe('[Moderation]', () => {
248248
expect(res.body).to.have.property('success', true);
249249
});
250250
});
251-
252-
it('should return an error when the userId && msgId is not provided', async () => {
253-
await request
254-
.post(api('moderation.dismissReports'))
255-
.set(credentials)
256-
.send({
257-
userId: '',
258-
msgId: '',
259-
})
260-
.expect('Content-Type', 'application/json')
261-
.expect(400)
262-
.expect((res: Response) => {
263-
expect(res.body).to.have.property('success', false);
264-
expect(res.body).to.have.property('error').and.to.be.a('string');
265-
});
266-
});
267251
});
268252

269253
describe('[/moderation.user.reportsByUserId]', () => {
@@ -294,24 +278,6 @@ describe('[Moderation]', () => {
294278
expect(res.body).to.have.property('reports').and.to.be.an('array').and.to.have.lengthOf(1);
295279
});
296280
});
297-
298-
it('should return an error when the userId is not provided', async () => {
299-
await request
300-
.get(api('moderation.user.reportsByUserId'))
301-
.set(credentials)
302-
.query({
303-
userId: '',
304-
count: 5,
305-
offset: 0,
306-
})
307-
.expect('Content-Type', 'application/json')
308-
.expect(400)
309-
.expect(async (res: Response) => {
310-
expect(res.body).to.have.property('success', false);
311-
expect(res.body).to.have.property('error');
312-
expect(res.body).to.have.property('errorType', 'invalid-params');
313-
});
314-
});
315281
});
316282

317283
describe('[/moderation.dismissUserReports', () => {
@@ -343,21 +309,6 @@ describe('[Moderation]', () => {
343309
expect(res.reports).to.have.lengthOf(0);
344310
});
345311
});
346-
347-
it('should return an error when the userId is not provided', async () => {
348-
await request
349-
.post(api('moderation.dismissUserReports'))
350-
.set(credentials)
351-
.send({
352-
userId: '',
353-
})
354-
.expect('Content-Type', 'application/json')
355-
.expect(400)
356-
.expect((res: Response) => {
357-
expect(res.body).to.have.property('success', false);
358-
expect(res.body).to.have.property('error').and.to.be.a('string');
359-
});
360-
});
361312
});
362313

363314
// test for testing out the moderation.reports endpoint
@@ -428,21 +379,6 @@ describe('[Moderation]', () => {
428379
expect(res.body).to.have.property('reports').and.to.be.an('array');
429380
});
430381
});
431-
432-
it('should return an error when the msgId is not provided', async () => {
433-
await request
434-
.get(api('moderation.reports'))
435-
.set(credentials)
436-
.query({
437-
msgId: '',
438-
})
439-
.expect('Content-Type', 'application/json')
440-
.expect(400)
441-
.expect((res: Response) => {
442-
expect(res.body).to.have.property('success', false);
443-
expect(res.body).to.have.property('error').and.to.be.a('string');
444-
});
445-
});
446382
});
447383

448384
// test for testing out the moderation.reportInfo endpoint
@@ -533,36 +469,6 @@ describe('[Moderation]', () => {
533469
});
534470
});
535471

536-
it('should return an error when the reportId is not provided', async () => {
537-
await request
538-
.get(api('moderation.reportInfo'))
539-
.set(credentials)
540-
.query({
541-
reportId: '',
542-
})
543-
.expect('Content-Type', 'application/json')
544-
.expect(400)
545-
.expect((res: Response) => {
546-
expect(res.body).to.have.property('success', false);
547-
expect(res.body).to.have.property('error').and.to.be.a('string');
548-
});
549-
});
550-
551-
it('should return an error when the reportId is invalid', async () => {
552-
await request
553-
.get(api('moderation.reportInfo'))
554-
.set(credentials)
555-
.query({
556-
reportId: 'invalid',
557-
})
558-
.expect('Content-Type', 'application/json')
559-
.expect(400)
560-
.expect((res: Response) => {
561-
expect(res.body).to.have.property('success', false);
562-
expect(res.body).to.have.property('error').and.to.be.a('string');
563-
});
564-
});
565-
566472
it('should return an error when the reportId is not found', async () => {
567473
await request
568474
.get(api('moderation.reportInfo'))
@@ -665,21 +571,6 @@ describe('[Moderation]', () => {
665571
expect(res.body).to.have.property('messages').and.to.be.an('array');
666572
});
667573
});
668-
669-
it('should return an error when the userId is not provided', async () => {
670-
await request
671-
.get(api('moderation.user.reportedMessages'))
672-
.set(credentials)
673-
.query({
674-
userId: '',
675-
})
676-
.expect('Content-Type', 'application/json')
677-
.expect(400)
678-
.expect((res: Response) => {
679-
expect(res.body).to.have.property('success', false);
680-
expect(res.body).to.have.property('error').and.to.be.a('string');
681-
});
682-
});
683574
});
684575

685576
// test for testing out the moderation.user.deleteReportedMessages endpoint
@@ -752,21 +643,6 @@ describe('[Moderation]', () => {
752643
expect(res.body).to.have.property('success', true);
753644
});
754645
});
755-
756-
it('should return an error when the userId is not provided', async () => {
757-
await request
758-
.post(api('moderation.user.deleteReportedMessages'))
759-
.set(credentials)
760-
.send({
761-
userId: '',
762-
})
763-
.expect('Content-Type', 'application/json')
764-
.expect(400)
765-
.expect((res: Response) => {
766-
expect(res.body).to.have.property('success', false);
767-
expect(res.body).to.have.property('error').and.to.be.a('string');
768-
});
769-
});
770646
});
771647

772648
describe('[/moderation.reportUser]', () => {
@@ -794,21 +670,5 @@ describe('[Moderation]', () => {
794670
expect(res.body).to.have.property('success', true);
795671
});
796672
});
797-
798-
it('should fail to report an user if not provided description', async () => {
799-
await request
800-
.post(api('moderation.reportUser'))
801-
.set(credentials)
802-
.send({
803-
userId: userToBeReported?._id,
804-
})
805-
.expect('Content-Type', 'application/json')
806-
.expect(400)
807-
.expect((res: Response) => {
808-
expect(res.body).to.have.property('success', false);
809-
expect(res.body).to.have.property('error');
810-
expect(res.body).to.have.property('errorType', 'invalid-params');
811-
});
812-
});
813673
});
814674
});

0 commit comments

Comments
 (0)