more robust test of unlike a comment, confirm replication to instance downstream from community home

pull/3657/head
RocketDerp 2023-07-18 05:51:07 -07:00 committed by GitHub
parent 38c6210912
commit fb7df85bd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 23 additions and 1 deletions

View File

@ -227,10 +227,22 @@ test("Remove a comment from admin and community on different instance", async ()
test("Unlike a comment", async () => { test("Unlike a comment", async () => {
let commentRes = await createComment(alpha, postRes.post_view.post.id); let commentRes = await createComment(alpha, postRes.post_view.post.id);
// Lemmy automatically creates 1 like (vote) by author of comment.
// Make sure that comment is liked (voted up) on gamma, downstream peer
// This is testing replication from remote-home-remote (alpha-beta-gamma)
let gammaComment1 = (
await resolveComment(gamma, commentRes.comment_view.comment)
).comment;
expect(gammaComment1).toBeDefined();
expect(gammaComment1?.community.local).toBe(false);
expect(gammaComment1?.creator.local).toBe(false);
expect(gammaComment1?.counts.score).toBe(1);
let unlike = await likeComment(alpha, 0, commentRes.comment_view.comment); let unlike = await likeComment(alpha, 0, commentRes.comment_view.comment);
expect(unlike.comment_view.counts.score).toBe(0); expect(unlike.comment_view.counts.score).toBe(0);
// Make sure that post is unliked on beta // Make sure that comment is unliked on beta
let betaComment = ( let betaComment = (
await resolveComment(beta, commentRes.comment_view.comment) await resolveComment(beta, commentRes.comment_view.comment)
).comment; ).comment;
@ -238,6 +250,16 @@ test("Unlike a comment", async () => {
expect(betaComment?.community.local).toBe(true); expect(betaComment?.community.local).toBe(true);
expect(betaComment?.creator.local).toBe(false); expect(betaComment?.creator.local).toBe(false);
expect(betaComment?.counts.score).toBe(0); expect(betaComment?.counts.score).toBe(0);
// Make sure that comment is unliked on gamma, downstream peer
// This is testing replication from remote-home-remote (alpha-beta-gamma)
let gammaComment = (
await resolveComment(gamma, commentRes.comment_view.comment)
).comment;
expect(gammaComment).toBeDefined();
expect(gammaComment?.community.local).toBe(false);
expect(gammaComment?.creator.local).toBe(false);
expect(gammaComment?.counts.score).toBe(0);
}); });
test("Federated comment like", async () => { test("Federated comment like", async () => {