]> Untitled Git - lemmy.git/blobdiff - api_tests/src/comment.spec.ts
Fixing drone tests.
[lemmy.git] / api_tests / src / comment.spec.ts
index 2ee3045c753a45adea1a42aee1d74790933736ae..693bdaf21b5207a5923fa7f4c70b6c0921cbc30f 100644 (file)
@@ -20,8 +20,6 @@ import {
   createCommunity,
   registerUser,
   API,
-  delay,
-  longDelay,
 } from './shared';
 import {
   Comment,
@@ -36,7 +34,6 @@ beforeAll(async () => {
   await followBeta(alpha);
   await followBeta(gamma);
   let search = await searchForBetaCommunity(alpha);
-  await longDelay();
   postRes = await createPost(
     alpha,
     search.communities.filter(c => c.local == false)[0].id
@@ -67,7 +64,6 @@ test('Create a comment', async () => {
   expect(commentRes.comment.community_local).toBe(false);
   expect(commentRes.comment.creator_local).toBe(true);
   expect(commentRes.comment.score).toBe(1);
-  await longDelay();
 
   // Make sure that comment is liked on beta
   let searchBeta = await searchComment(beta, commentRes.comment);
@@ -90,14 +86,12 @@ test('Update a comment', async () => {
   let searchBeta = await searchComment(beta, commentRes.comment);
   assertCommentFederation(searchBeta.comments[0], commentRes.comment);
 
-  await delay();
   let updateCommentRes = await updateComment(alpha, commentRes.comment.id);
   expect(updateCommentRes.comment.content).toBe(
     'A jest test federated comment update'
   );
   expect(updateCommentRes.comment.community_local).toBe(false);
   expect(updateCommentRes.comment.creator_local).toBe(true);
-  await delay();
 
   // Make sure that post is updated on beta
   let searchBetaUpdated = await searchComment(beta, commentRes.comment);
@@ -106,7 +100,6 @@ test('Update a comment', async () => {
 
 test('Delete a comment', async () => {
   let commentRes = await createComment(alpha, postRes.post.id);
-  await delay();
 
   let deleteCommentRes = await deleteComment(
     alpha,
@@ -114,13 +107,11 @@ test('Delete a comment', async () => {
     commentRes.comment.id
   );
   expect(deleteCommentRes.comment.deleted).toBe(true);
-  await delay();
 
   // Make sure that comment is undefined on beta
   let searchBeta = await searchComment(beta, commentRes.comment);
   let betaComment = searchBeta.comments[0];
   expect(betaComment).toBeUndefined();
-  await delay();
 
   let undeleteCommentRes = await deleteComment(
     alpha,
@@ -128,7 +119,6 @@ test('Delete a comment', async () => {
     commentRes.comment.id
   );
   expect(undeleteCommentRes.comment.deleted).toBe(false);
-  await delay();
 
   // Make sure that comment is undeleted on beta
   let searchBeta2 = await searchComment(beta, commentRes.comment);
@@ -139,7 +129,6 @@ test('Delete a comment', async () => {
 
 test('Remove a comment from admin and community on the same instance', async () => {
   let commentRes = await createComment(alpha, postRes.post.id);
-  await delay();
 
   // Get the id for beta
   let betaCommentId = (await searchComment(beta, commentRes.comment))
@@ -148,7 +137,6 @@ test('Remove a comment from admin and community on the same instance', async ()
   // The beta admin removes it (the community lives on beta)
   let removeCommentRes = await removeComment(beta, true, betaCommentId);
   expect(removeCommentRes.comment.removed).toBe(true);
-  await longDelay();
 
   // Make sure that comment is removed on alpha (it gets pushed since an admin from beta removed it)
   let refetchedPost = await getPost(alpha, postRes.post.id);
@@ -156,7 +144,6 @@ test('Remove a comment from admin and community on the same instance', async ()
 
   let unremoveCommentRes = await removeComment(beta, false, betaCommentId);
   expect(unremoveCommentRes.comment.removed).toBe(false);
-  await longDelay();
 
   // Make sure that comment is unremoved on beta
   let refetchedPost2 = await getPost(alpha, postRes.post.id);
@@ -173,19 +160,15 @@ test('Remove a comment from admin and community on different instance', async ()
 
   // New alpha user creates a community, post, and comment.
   let newCommunity = await createCommunity(newAlphaApi);
-  await delay();
   let newPost = await createPost(newAlphaApi, newCommunity.community.id);
-  await delay();
   let commentRes = await createComment(newAlphaApi, newPost.post.id);
   expect(commentRes.comment.content).toBeDefined();
-  await delay();
 
   // Beta searches that to cache it, then removes it
   let searchBeta = await searchComment(beta, commentRes.comment);
   let betaComment = searchBeta.comments[0];
   let removeCommentRes = await removeComment(beta, true, betaComment.id);
   expect(removeCommentRes.comment.removed).toBe(true);
-  await delay();
 
   // Make sure its not removed on alpha
   let refetchedPost = await getPost(newAlphaApi, newPost.post.id);
@@ -195,10 +178,8 @@ test('Remove a comment from admin and community on different instance', async ()
 
 test('Unlike a comment', async () => {
   let commentRes = await createComment(alpha, postRes.post.id);
-  await delay();
   let unlike = await likeComment(alpha, 0, commentRes.comment);
   expect(unlike.comment.score).toBe(0);
-  await delay();
 
   // Make sure that post is unliked on beta
   let searchBeta = await searchComment(beta, commentRes.comment);
@@ -211,7 +192,6 @@ test('Unlike a comment', async () => {
 
 test('Federated comment like', async () => {
   let commentRes = await createComment(alpha, postRes.post.id);
-  await longDelay();
 
   // Find the comment on beta
   let searchBeta = await searchComment(beta, commentRes.comment);
@@ -219,7 +199,6 @@ test('Federated comment like', async () => {
 
   let like = await likeComment(beta, 1, betaComment);
   expect(like.comment.score).toBe(2);
-  await longDelay();
 
   // Get the post from alpha, check the likes
   let post = await getPost(alpha, postRes.post.id);
@@ -229,7 +208,6 @@ test('Federated comment like', async () => {
 test('Reply to a comment', async () => {
   // Create a comment on alpha, find it on beta
   let commentRes = await createComment(alpha, postRes.post.id);
-  await delay();
   let searchBeta = await searchComment(beta, commentRes.comment);
   let betaComment = searchBeta.comments[0];
 
@@ -242,7 +220,6 @@ test('Reply to a comment', async () => {
   expect(replyRes.comment.creator_local).toBe(true);
   expect(replyRes.comment.parent_id).toBe(betaComment.id);
   expect(replyRes.comment.score).toBe(1);
-  await longDelay();
 
   // Make sure that comment is seen on alpha
   // TODO not sure why, but a searchComment back to alpha, for the ap_id of betas
@@ -262,7 +239,6 @@ test('Mention beta', async () => {
   // Create a mention on alpha
   let mentionContent = 'A test mention of @lemmy_beta@lemmy-beta:8551';
   let commentRes = await createComment(alpha, postRes.post.id);
-  await delay();
   let mentionRes = await createComment(
     alpha,
     postRes.post.id,
@@ -273,7 +249,6 @@ test('Mention beta', async () => {
   expect(mentionRes.comment.community_local).toBe(false);
   expect(mentionRes.comment.creator_local).toBe(true);
   expect(mentionRes.comment.score).toBe(1);
-  await delay();
 
   let mentionsRes = await getMentions(beta);
   expect(mentionsRes.mentions[0].content).toBeDefined();
@@ -284,7 +259,6 @@ test('Mention beta', async () => {
 
 test('Comment Search', async () => {
   let commentRes = await createComment(alpha, postRes.post.id);
-  await delay();
   let searchBeta = await searchComment(beta, commentRes.comment);
   assertCommentFederation(searchBeta.comments[0], commentRes.comment);
 });
@@ -293,7 +267,6 @@ test('A and G subscribe to B (center) A posts, G mentions B, it gets announced t
   // Create a local post
   let alphaPost = await createPost(alpha, 2);
   expect(alphaPost.post.community_local).toBe(true);
-  await delay();
 
   // Make sure gamma sees it
   let search = await searchPost(gamma, alphaPost.post);
@@ -311,7 +284,6 @@ test('A and G subscribe to B (center) A posts, G mentions B, it gets announced t
   expect(commentRes.comment.community_local).toBe(false);
   expect(commentRes.comment.creator_local).toBe(true);
   expect(commentRes.comment.score).toBe(1);
-  await longDelay();
 
   // Make sure alpha sees it
   let alphaPost2 = await getPost(alpha, alphaPost.post.id);
@@ -320,7 +292,6 @@ test('A and G subscribe to B (center) A posts, G mentions B, it gets announced t
   expect(alphaPost2.comments[0].creator_local).toBe(false);
   expect(alphaPost2.comments[0].score).toBe(1);
   assertCommentFederation(alphaPost2.comments[0], commentRes.comment);
-  await delay();
 
   // Make sure beta has mentions
   let mentionsRes = await getMentions(beta);
@@ -341,7 +312,6 @@ test('Fetch in_reply_tos: A is unsubbed from B, B makes a post, and some embedde
   // B creates a post, and two comments, should be invisible to A
   let postRes = await createPost(beta, 2);
   expect(postRes.post.name).toBeDefined();
-  await delay();
 
   let parentCommentContent = 'An invisible top level comment from beta';
   let parentCommentRes = await createComment(
@@ -351,7 +321,6 @@ test('Fetch in_reply_tos: A is unsubbed from B, B makes a post, and some embedde
     parentCommentContent
   );
   expect(parentCommentRes.comment.content).toBe(parentCommentContent);
-  await delay();
 
   // B creates a comment, then a child one of that.
   let childCommentContent = 'An invisible child comment from beta';
@@ -362,13 +331,11 @@ test('Fetch in_reply_tos: A is unsubbed from B, B makes a post, and some embedde
     childCommentContent
   );
   expect(childCommentRes.comment.content).toBe(childCommentContent);
-  await delay();
 
   // Follow beta again
   let follow = await followBeta(alpha);
   expect(follow.community.local).toBe(false);
   expect(follow.community.name).toBe('main');
-  await delay();
 
   // 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';
@@ -378,12 +345,10 @@ test('Fetch in_reply_tos: A is unsubbed from B, B makes a post, and some embedde
     updatedCommentContent
   );
   expect(updateRes.comment.content).toBe(updatedCommentContent);
-  await delay();
 
   // Get the post from alpha
   let search = await searchPost(alpha, postRes.post);
   let alphaPostB = search.posts[0];
-  await longDelay();
 
   let alphaPost = await getPost(alpha, alphaPostB.id);
   expect(alphaPost.post.name).toBeDefined();