]> git.immae.eu Git - github/Chocobozzz/PeerTube.git/blobdiff - server/tests/utils/videos/video-comments.ts
Add ability to delete comments
[github/Chocobozzz/PeerTube.git] / server / tests / utils / videos / video-comments.ts
index 8781470496d6d091267c900cd5ca952c0dc85673..1b9ee452eeb1d71a12dd41de25b4a657096c3fda 100644 (file)
@@ -1,4 +1,5 @@
 import * as request from 'supertest'
+import { makeDeleteRequest } from '../'
 
 function getVideoCommentThreads (url: string, videoId: number | string, start: number, count: number, sort?: string) {
   const path = '/api/v1/videos/' + videoId + '/comment-threads'
@@ -54,11 +55,29 @@ function addVideoCommentReply (
     .expect(expectedStatus)
 }
 
+function deleteVideoComment (
+  url: string,
+  token: string,
+  videoId: number | string,
+  commentId: number,
+  statusCodeExpected = 204
+) {
+  const path = '/api/v1/videos/' + videoId + '/comments/' + commentId
+
+  return makeDeleteRequest({
+    url,
+    path,
+    token,
+    statusCodeExpected
+  })
+}
+
 // ---------------------------------------------------------------------------
 
 export {
   getVideoCommentThreads,
   getVideoThreadComments,
   addVideoCommentThread,
-  addVideoCommentReply
+  addVideoCommentReply,
+  deleteVideoComment
 }