2020-10-01 13:32:01 +00:00
jest . setTimeout ( 180000 ) ;
2020-08-04 14:57:37 +00:00
import {
alpha ,
beta ,
gamma ,
setupLogins ,
createPost ,
getPost ,
2021-08-23 15:25:39 +00:00
resolveComment ,
2020-08-04 14:57:37 +00:00
likeComment ,
followBeta ,
2021-08-23 15:25:39 +00:00
resolveBetaCommunity ,
2020-08-04 14:57:37 +00:00
createComment ,
2020-12-20 21:16:57 +00:00
editComment ,
2020-08-04 14:57:37 +00:00
deleteComment ,
removeComment ,
getMentions ,
2021-08-23 15:25:39 +00:00
resolvePost ,
2020-08-04 14:57:37 +00:00
unfollowRemotes ,
2020-08-06 18:30:01 +00:00
createCommunity ,
registerUser ,
2021-10-15 14:37:33 +00:00
reportComment ,
listCommentReports ,
randomString ,
2020-08-06 18:30:01 +00:00
API ,
2020-08-04 14:57:37 +00:00
} from './shared' ;
2020-12-20 21:16:57 +00:00
import { CommentView } from 'lemmy-js-client' ;
2020-08-04 14:57:37 +00:00
2020-08-20 14:50:26 +00:00
import { PostResponse } from 'lemmy-js-client' ;
2020-08-04 14:57:37 +00:00
let postRes : PostResponse ;
beforeAll ( async ( ) = > {
await setupLogins ( ) ;
await followBeta ( alpha ) ;
await followBeta ( gamma ) ;
2021-08-23 15:25:39 +00:00
let betaCommunity = ( await resolveBetaCommunity ( alpha ) ) . community ;
2020-08-04 14:57:37 +00:00
postRes = await createPost (
alpha ,
2021-08-23 15:25:39 +00:00
betaCommunity . community . id
2020-08-04 14:57:37 +00:00
) ;
} ) ;
afterAll ( async ( ) = > {
await unfollowRemotes ( alpha ) ;
await unfollowRemotes ( gamma ) ;
} ) ;
2020-09-17 15:41:51 +00:00
function assertCommentFederation (
2020-12-20 21:16:57 +00:00
commentOne : CommentView ,
commentTwo : CommentView
) {
expect ( commentOne . comment . ap_id ) . toBe ( commentOne . comment . ap_id ) ;
expect ( commentOne . comment . content ) . toBe ( commentTwo . comment . content ) ;
expect ( commentOne . creator . name ) . toBe ( commentTwo . creator . name ) ;
expect ( commentOne . community . actor_id ) . toBe ( commentTwo . community . actor_id ) ;
expect ( commentOne . comment . published ) . toBe ( commentTwo . comment . published ) ;
expect ( commentOne . comment . updated ) . toBe ( commentOne . comment . updated ) ;
expect ( commentOne . comment . deleted ) . toBe ( commentOne . comment . deleted ) ;
expect ( commentOne . comment . removed ) . toBe ( commentOne . comment . removed ) ;
2020-09-17 15:41:51 +00:00
}
2020-08-04 14:57:37 +00:00
test ( 'Create a comment' , async ( ) = > {
2020-12-20 21:16:57 +00:00
let commentRes = await createComment ( alpha , postRes . post_view . post . id ) ;
expect ( commentRes . comment_view . comment . content ) . toBeDefined ( ) ;
expect ( commentRes . comment_view . community . local ) . toBe ( false ) ;
expect ( commentRes . comment_view . creator . local ) . toBe ( true ) ;
expect ( commentRes . comment_view . counts . score ) . toBe ( 1 ) ;
2020-08-04 14:57:37 +00:00
// Make sure that comment is liked on beta
2021-08-23 15:25:39 +00:00
let betaComment = ( await resolveComment ( beta , commentRes . comment_view . comment ) ) . comment ;
2020-08-04 14:57:37 +00:00
expect ( betaComment ) . toBeDefined ( ) ;
2020-12-20 21:16:57 +00:00
expect ( betaComment . community . local ) . toBe ( true ) ;
expect ( betaComment . creator . local ) . toBe ( false ) ;
expect ( betaComment . counts . score ) . toBe ( 1 ) ;
assertCommentFederation ( betaComment , commentRes . comment_view ) ;
2020-08-04 14:57:37 +00:00
} ) ;
2020-08-20 12:44:22 +00:00
test ( 'Create a comment in a non-existent post' , async ( ) = > {
let commentRes = await createComment ( alpha , - 1 ) ;
expect ( commentRes ) . toStrictEqual ( { error : 'couldnt_find_post' } ) ;
} ) ;
2020-08-04 14:57:37 +00:00
test ( 'Update a comment' , async ( ) = > {
2020-12-20 21:16:57 +00:00
let commentRes = await createComment ( alpha , postRes . post_view . post . id ) ;
2020-09-17 15:41:51 +00:00
// Federate the comment first
2021-08-23 15:25:39 +00:00
let betaComment = ( await resolveComment ( beta , commentRes . comment_view . comment ) ) . comment ;
assertCommentFederation ( betaComment , commentRes . comment_view ) ;
2020-09-17 15:41:51 +00:00
2020-12-20 21:16:57 +00:00
let updateCommentRes = await editComment (
alpha ,
commentRes . comment_view . comment . id
) ;
expect ( updateCommentRes . comment_view . comment . content ) . toBe (
2020-08-04 14:57:37 +00:00
'A jest test federated comment update'
) ;
2020-12-20 21:16:57 +00:00
expect ( updateCommentRes . comment_view . community . local ) . toBe ( false ) ;
expect ( updateCommentRes . comment_view . creator . local ) . toBe ( true ) ;
2020-08-04 14:57:37 +00:00
// Make sure that post is updated on beta
2021-08-23 15:25:39 +00:00
let betaCommentUpdated = ( await resolveComment (
2020-12-20 21:16:57 +00:00
beta ,
commentRes . comment_view . comment
2021-08-23 15:25:39 +00:00
) ) . comment ;
2020-12-20 21:16:57 +00:00
assertCommentFederation (
2021-08-23 15:25:39 +00:00
betaCommentUpdated ,
2020-12-20 21:16:57 +00:00
updateCommentRes . comment_view
) ;
2020-08-04 14:57:37 +00:00
} ) ;
test ( 'Delete a comment' , async ( ) = > {
2020-12-20 21:16:57 +00:00
let commentRes = await createComment ( alpha , postRes . post_view . post . id ) ;
2020-08-31 13:48:02 +00:00
2020-08-04 14:57:37 +00:00
let deleteCommentRes = await deleteComment (
alpha ,
true ,
2020-12-20 21:16:57 +00:00
commentRes . comment_view . comment . id
2020-08-04 14:57:37 +00:00
) ;
2020-12-20 21:16:57 +00:00
expect ( deleteCommentRes . comment_view . comment . deleted ) . toBe ( true ) ;
2021-07-30 18:44:15 +00:00
expect ( deleteCommentRes . comment_view . comment . content ) . toBe ( "" ) ;
2020-08-04 14:57:37 +00:00
2020-08-31 13:48:02 +00:00
// Make sure that comment is undefined on beta
2021-08-23 15:25:39 +00:00
let betaCommentRes : any = await resolveComment ( beta , commentRes . comment_view . comment ) ;
expect ( betaCommentRes ) . toStrictEqual ( { error : 'couldnt_find_object' } ) ;
2020-08-04 14:57:37 +00:00
let undeleteCommentRes = await deleteComment (
alpha ,
false ,
2020-12-20 21:16:57 +00:00
commentRes . comment_view . comment . id
2020-08-04 14:57:37 +00:00
) ;
2020-12-20 21:16:57 +00:00
expect ( undeleteCommentRes . comment_view . comment . deleted ) . toBe ( false ) ;
2020-08-04 14:57:37 +00:00
// Make sure that comment is undeleted on beta
2021-08-23 15:25:39 +00:00
let betaComment2 = ( await resolveComment ( beta , commentRes . comment_view . comment ) ) . comment ;
2020-12-20 21:16:57 +00:00
expect ( betaComment2 . comment . deleted ) . toBe ( false ) ;
assertCommentFederation (
2021-08-23 15:25:39 +00:00
betaComment2 ,
2020-12-20 21:16:57 +00:00
undeleteCommentRes . comment_view
) ;
2020-08-04 14:57:37 +00:00
} ) ;
2020-08-07 14:51:53 +00:00
test ( 'Remove a comment from admin and community on the same instance' , async ( ) = > {
2020-12-20 21:16:57 +00:00
let commentRes = await createComment ( alpha , postRes . post_view . post . id ) ;
2020-08-06 18:30:01 +00:00
// Get the id for beta
2020-12-20 21:16:57 +00:00
let betaCommentId = (
2021-08-23 15:25:39 +00:00
await resolveComment ( beta , commentRes . comment_view . comment )
) . comment . comment . id ;
2020-08-06 18:30:01 +00:00
// The beta admin removes it (the community lives on beta)
let removeCommentRes = await removeComment ( beta , true , betaCommentId ) ;
2020-12-20 21:16:57 +00:00
expect ( removeCommentRes . comment_view . comment . removed ) . toBe ( true ) ;
2021-07-30 18:44:15 +00:00
expect ( removeCommentRes . comment_view . comment . content ) . toBe ( "" ) ;
2020-08-04 14:57:37 +00:00
2020-08-06 18:30:01 +00:00
// Make sure that comment is removed on alpha (it gets pushed since an admin from beta removed it)
2020-12-20 21:16:57 +00:00
let refetchedPost = await getPost ( alpha , postRes . post_view . post . id ) ;
expect ( refetchedPost . comments [ 0 ] . comment . removed ) . toBe ( true ) ;
2020-08-04 14:57:37 +00:00
2020-08-06 18:30:01 +00:00
let unremoveCommentRes = await removeComment ( beta , false , betaCommentId ) ;
2020-12-20 21:16:57 +00:00
expect ( unremoveCommentRes . comment_view . comment . removed ) . toBe ( false ) ;
2020-08-04 14:57:37 +00:00
// Make sure that comment is unremoved on beta
2020-12-20 21:16:57 +00:00
let refetchedPost2 = await getPost ( alpha , postRes . post_view . post . id ) ;
expect ( refetchedPost2 . comments [ 0 ] . comment . removed ) . toBe ( false ) ;
assertCommentFederation (
refetchedPost2 . comments [ 0 ] ,
unremoveCommentRes . comment_view
) ;
2020-08-06 18:30:01 +00:00
} ) ;
2020-08-07 14:51:53 +00:00
test ( 'Remove a comment from admin and community on different instance' , async ( ) = > {
2020-08-06 18:30:01 +00:00
let alphaUser = await registerUser ( alpha ) ;
let newAlphaApi : API = {
2020-08-20 14:50:26 +00:00
client : alpha.client ,
2020-08-06 18:30:01 +00:00
auth : alphaUser.jwt ,
} ;
// New alpha user creates a community, post, and comment.
let newCommunity = await createCommunity ( newAlphaApi ) ;
2020-12-20 21:16:57 +00:00
let newPost = await createPost (
newAlphaApi ,
newCommunity . community_view . community . id
) ;
let commentRes = await createComment ( newAlphaApi , newPost . post_view . post . id ) ;
expect ( commentRes . comment_view . comment . content ) . toBeDefined ( ) ;
2020-08-06 18:30:01 +00:00
// Beta searches that to cache it, then removes it
2021-08-23 15:25:39 +00:00
let betaComment = ( await resolveComment ( beta , commentRes . comment_view . comment ) ) . comment ;
2020-12-20 21:16:57 +00:00
let removeCommentRes = await removeComment (
beta ,
true ,
betaComment . comment . id
) ;
expect ( removeCommentRes . comment_view . comment . removed ) . toBe ( true ) ;
2020-08-06 18:30:01 +00:00
// Make sure its not removed on alpha
2020-12-20 21:16:57 +00:00
let refetchedPost = await getPost ( newAlphaApi , newPost . post_view . post . id ) ;
expect ( refetchedPost . comments [ 0 ] . comment . removed ) . toBe ( false ) ;
assertCommentFederation ( refetchedPost . comments [ 0 ] , commentRes . comment_view ) ;
2020-08-04 14:57:37 +00:00
} ) ;
test ( 'Unlike a comment' , async ( ) = > {
2020-12-20 21:16:57 +00:00
let commentRes = await createComment ( alpha , postRes . post_view . post . id ) ;
let unlike = await likeComment ( alpha , 0 , commentRes . comment_view . comment ) ;
expect ( unlike . comment_view . counts . score ) . toBe ( 0 ) ;
2020-08-04 14:57:37 +00:00
// Make sure that post is unliked on beta
2021-08-23 15:25:39 +00:00
let betaComment = ( await resolveComment ( beta , commentRes . comment_view . comment ) ) . comment ;
2020-08-04 14:57:37 +00:00
expect ( betaComment ) . toBeDefined ( ) ;
2020-12-20 21:16:57 +00:00
expect ( betaComment . community . local ) . toBe ( true ) ;
expect ( betaComment . creator . local ) . toBe ( false ) ;
expect ( betaComment . counts . score ) . toBe ( 0 ) ;
2020-08-04 14:57:37 +00:00
} ) ;
test ( 'Federated comment like' , async ( ) = > {
2020-12-20 21:16:57 +00:00
let commentRes = await createComment ( alpha , postRes . post_view . post . id ) ;
2020-08-04 14:57:37 +00:00
// Find the comment on beta
2021-08-23 15:25:39 +00:00
let betaComment = ( await resolveComment ( beta , commentRes . comment_view . comment ) ) . comment ;
2020-08-04 14:57:37 +00:00
2020-12-20 21:16:57 +00:00
let like = await likeComment ( beta , 1 , betaComment . comment ) ;
expect ( like . comment_view . counts . score ) . toBe ( 2 ) ;
2020-08-04 14:57:37 +00:00
// Get the post from alpha, check the likes
2020-12-20 21:16:57 +00:00
let post = await getPost ( alpha , postRes . post_view . post . id ) ;
expect ( post . comments [ 0 ] . counts . score ) . toBe ( 2 ) ;
2020-08-04 14:57:37 +00:00
} ) ;
test ( 'Reply to a comment' , async ( ) = > {
// Create a comment on alpha, find it on beta
2020-12-20 21:16:57 +00:00
let commentRes = await createComment ( alpha , postRes . post_view . post . id ) ;
2021-08-23 15:25:39 +00:00
let betaComment = ( await resolveComment ( beta , commentRes . comment_view . comment ) ) . comment ;
2020-08-04 14:57:37 +00:00
// find that comment id on beta
// Reply from beta
2020-12-20 21:16:57 +00:00
let replyRes = await createComment (
beta ,
betaComment . post . id ,
betaComment . comment . id
) ;
expect ( replyRes . comment_view . comment . content ) . toBeDefined ( ) ;
expect ( replyRes . comment_view . community . local ) . toBe ( true ) ;
expect ( replyRes . comment_view . creator . local ) . toBe ( true ) ;
expect ( replyRes . comment_view . comment . parent_id ) . toBe ( betaComment . comment . id ) ;
expect ( replyRes . comment_view . counts . score ) . toBe ( 1 ) ;
2020-08-04 14:57:37 +00:00
// Make sure that comment is seen on alpha
// TODO not sure why, but a searchComment back to alpha, for the ap_id of betas
// comment, isn't working.
// let searchAlpha = await searchComment(alpha, replyRes.comment);
2020-12-20 21:16:57 +00:00
let post = await getPost ( alpha , postRes . post_view . post . id ) ;
2020-08-04 14:57:37 +00:00
let alphaComment = post . comments [ 0 ] ;
2020-12-20 21:16:57 +00:00
expect ( alphaComment . comment . content ) . toBeDefined ( ) ;
expect ( alphaComment . comment . parent_id ) . toBe ( post . comments [ 1 ] . comment . id ) ;
expect ( alphaComment . community . local ) . toBe ( false ) ;
expect ( alphaComment . creator . local ) . toBe ( false ) ;
expect ( alphaComment . counts . score ) . toBe ( 1 ) ;
assertCommentFederation ( alphaComment , replyRes . comment_view ) ;
2020-08-04 14:57:37 +00:00
} ) ;
test ( 'Mention beta' , async ( ) = > {
// Create a mention on alpha
2020-09-15 19:26:47 +00:00
let mentionContent = 'A test mention of @lemmy_beta@lemmy-beta:8551' ;
2020-12-20 21:16:57 +00:00
let commentRes = await createComment ( alpha , postRes . post_view . post . id ) ;
2020-08-04 14:57:37 +00:00
let mentionRes = await createComment (
alpha ,
2020-12-20 21:16:57 +00:00
postRes . post_view . post . id ,
commentRes . comment_view . comment . id ,
2020-08-04 14:57:37 +00:00
mentionContent
) ;
2020-12-20 21:16:57 +00:00
expect ( mentionRes . comment_view . comment . content ) . toBeDefined ( ) ;
expect ( mentionRes . comment_view . community . local ) . toBe ( false ) ;
expect ( mentionRes . comment_view . creator . local ) . toBe ( true ) ;
expect ( mentionRes . comment_view . counts . score ) . toBe ( 1 ) ;
2020-08-04 14:57:37 +00:00
let mentionsRes = await getMentions ( beta ) ;
2020-12-20 21:16:57 +00:00
expect ( mentionsRes . mentions [ 0 ] . comment . content ) . toBeDefined ( ) ;
expect ( mentionsRes . mentions [ 0 ] . community . local ) . toBe ( true ) ;
expect ( mentionsRes . mentions [ 0 ] . creator . local ) . toBe ( false ) ;
expect ( mentionsRes . mentions [ 0 ] . counts . score ) . toBe ( 1 ) ;
2020-08-04 14:57:37 +00:00
} ) ;
test ( 'Comment Search' , async ( ) = > {
2020-12-20 21:16:57 +00:00
let commentRes = await createComment ( alpha , postRes . post_view . post . id ) ;
2021-08-23 15:25:39 +00:00
let betaComment = ( await resolveComment ( beta , commentRes . comment_view . comment ) ) . comment ;
assertCommentFederation ( betaComment , commentRes . comment_view ) ;
2020-08-04 14:57:37 +00:00
} ) ;
test ( 'A and G subscribe to B (center) A posts, G mentions B, it gets announced to A' , async ( ) = > {
// Create a local post
let alphaPost = await createPost ( alpha , 2 ) ;
2020-12-20 21:16:57 +00:00
expect ( alphaPost . post_view . community . local ) . toBe ( true ) ;
2020-08-04 14:57:37 +00:00
// Make sure gamma sees it
2021-08-23 15:25:39 +00:00
let gammaPost = ( await resolvePost ( gamma , alphaPost . post_view . post ) ) . post ;
2020-08-04 14:57:37 +00:00
let commentContent =
2020-09-15 19:26:47 +00:00
'A jest test federated comment announce, lets mention @lemmy_beta@lemmy-beta:8551' ;
2020-08-04 14:57:37 +00:00
let commentRes = await createComment (
gamma ,
2020-12-20 21:16:57 +00:00
gammaPost . post . id ,
2020-08-04 14:57:37 +00:00
undefined ,
commentContent
) ;
2020-12-20 21:16:57 +00:00
expect ( commentRes . comment_view . comment . content ) . toBe ( commentContent ) ;
expect ( commentRes . comment_view . community . local ) . toBe ( false ) ;
expect ( commentRes . comment_view . creator . local ) . toBe ( true ) ;
expect ( commentRes . comment_view . counts . score ) . toBe ( 1 ) ;
2020-08-04 14:57:37 +00:00
// Make sure alpha sees it
2020-12-20 21:16:57 +00:00
let alphaPost2 = await getPost ( alpha , alphaPost . post_view . post . id ) ;
expect ( alphaPost2 . comments [ 0 ] . comment . content ) . toBe ( commentContent ) ;
expect ( alphaPost2 . comments [ 0 ] . community . local ) . toBe ( true ) ;
expect ( alphaPost2 . comments [ 0 ] . creator . local ) . toBe ( false ) ;
expect ( alphaPost2 . comments [ 0 ] . counts . score ) . toBe ( 1 ) ;
assertCommentFederation ( alphaPost2 . comments [ 0 ] , commentRes . comment_view ) ;
2020-08-04 14:57:37 +00:00
// Make sure beta has mentions
let mentionsRes = await getMentions ( beta ) ;
2020-12-20 21:16:57 +00:00
expect ( mentionsRes . mentions [ 0 ] . comment . content ) . toBe ( commentContent ) ;
expect ( mentionsRes . mentions [ 0 ] . community . local ) . toBe ( false ) ;
expect ( mentionsRes . mentions [ 0 ] . creator . local ) . toBe ( false ) ;
2020-08-04 14:57:37 +00:00
// TODO this is failing because fetchInReplyTos aren't getting score
// expect(mentionsRes.mentions[0].score).toBe(1);
} ) ;
test ( 'Fetch in_reply_tos: A is unsubbed from B, B makes a post, and some embedded comments, A subs to B, B updates the lowest level comment, A fetches both the post and all the inreplyto comments for that post.' , async ( ) = > {
// Unfollow all remote communities
2021-08-19 20:54:15 +00:00
let site = await unfollowRemotes ( alpha ) ;
2020-08-04 14:57:37 +00:00
expect (
2021-08-19 20:54:15 +00:00
site . my_user . follows . filter ( c = > c . community . local == false ) . length
2020-08-04 14:57:37 +00:00
) . toBe ( 0 ) ;
// B creates a post, and two comments, should be invisible to A
let postRes = await createPost ( beta , 2 ) ;
2020-12-20 21:16:57 +00:00
expect ( postRes . post_view . post . name ) . toBeDefined ( ) ;
2020-08-04 14:57:37 +00:00
let parentCommentContent = 'An invisible top level comment from beta' ;
let parentCommentRes = await createComment (
beta ,
2020-12-20 21:16:57 +00:00
postRes . post_view . post . id ,
2020-08-04 14:57:37 +00:00
undefined ,
parentCommentContent
) ;
2020-12-20 21:16:57 +00:00
expect ( parentCommentRes . comment_view . comment . content ) . toBe (
parentCommentContent
) ;
2020-08-04 14:57:37 +00:00
// B creates a comment, then a child one of that.
let childCommentContent = 'An invisible child comment from beta' ;
let childCommentRes = await createComment (
beta ,
2020-12-20 21:16:57 +00:00
postRes . post_view . post . id ,
parentCommentRes . comment_view . comment . id ,
childCommentContent
) ;
expect ( childCommentRes . comment_view . comment . content ) . toBe (
2020-08-04 14:57:37 +00:00
childCommentContent
) ;
// Follow beta again
let follow = await followBeta ( alpha ) ;
2020-12-20 21:16:57 +00:00
expect ( follow . community_view . community . local ) . toBe ( false ) ;
expect ( follow . community_view . community . name ) . toBe ( 'main' ) ;
2020-08-04 14:57:37 +00:00
// An update to the child comment on beta, should push the post, parent, and child to alpha now
let updatedCommentContent = 'An update child comment from beta' ;
2020-12-20 21:16:57 +00:00
let updateRes = await editComment (
2020-08-04 14:57:37 +00:00
beta ,
2020-12-20 21:16:57 +00:00
childCommentRes . comment_view . comment . id ,
2020-08-04 14:57:37 +00:00
updatedCommentContent
) ;
2020-12-20 21:16:57 +00:00
expect ( updateRes . comment_view . comment . content ) . toBe ( updatedCommentContent ) ;
2020-08-04 14:57:37 +00:00
// Get the post from alpha
2021-08-23 15:25:39 +00:00
let alphaPostB = ( await resolvePost ( alpha , postRes . post_view . post ) ) . post ;
2020-08-31 13:48:02 +00:00
2020-12-20 21:16:57 +00:00
let alphaPost = await getPost ( alpha , alphaPostB . post . id ) ;
expect ( alphaPost . post_view . post . name ) . toBeDefined ( ) ;
assertCommentFederation ( alphaPost . comments [ 1 ] , parentCommentRes . comment_view ) ;
assertCommentFederation ( alphaPost . comments [ 0 ] , updateRes . comment_view ) ;
expect ( alphaPost . post_view . community . local ) . toBe ( false ) ;
expect ( alphaPost . post_view . creator . local ) . toBe ( false ) ;
2020-12-17 19:23:15 +00:00
await unfollowRemotes ( alpha ) ;
2020-08-04 14:57:37 +00:00
} ) ;
2021-10-15 14:37:33 +00:00
test ( 'Report a comment' , async ( ) = > {
let betaCommunity = ( await resolveBetaCommunity ( beta ) ) . community ;
console . log ( betaCommunity ) ;
let postRes = ( await createPost ( beta , betaCommunity . community . id ) ) . post_view . post ;
expect ( postRes ) . toBeDefined ( ) ;
let commentRes = ( await createComment ( beta , postRes . id ) ) . comment_view . comment ;
expect ( commentRes ) . toBeDefined ( ) ;
let alphaComment = ( await resolveComment ( alpha , commentRes ) ) . comment . comment ;
let alphaReport = ( await reportComment ( alpha , alphaComment . id , randomString ( 10 ) ) )
. comment_report_view . comment_report ;
let betaReport = ( await listCommentReports ( beta ) ) . comment_reports [ 0 ] . comment_report ;
expect ( betaReport ) . toBeDefined ( ) ;
expect ( betaReport . resolved ) . toBe ( false ) ;
expect ( betaReport . original_comment_text ) . toBe ( alphaReport . original_comment_text ) ;
expect ( betaReport . reason ) . toBe ( alphaReport . reason ) ;
} ) ;