Fixing tests again.

This commit is contained in:
Dessalines 2020-08-28 11:52:52 -04:00
parent 98cab90bb6
commit a5c0228e4c
3 changed files with 10 additions and 9 deletions

View File

@ -124,7 +124,7 @@ 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 delay();
await delay(5000);
// 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);

View File

@ -46,7 +46,7 @@ test('Create a post', async () => {
expect(postRes.post.community_local).toBe(false);
expect(postRes.post.creator_local).toBe(true);
expect(postRes.post.score).toBe(1);
await delay();
await delay(5000);
// Make sure that post is liked on beta
let searchBeta = await searchPost(beta, postRes.post);
@ -209,16 +209,17 @@ test('Delete a post', async () => {
// Make sure lemmy beta sees post is deleted
let newPost = await createPost(beta, 2);
await delay();
await delay(5000);
let createFakeBetaPostToGetId = newPost.post.id - 1;
let betaPost = await getPost(beta, createFakeBetaPostToGetId);
expect(betaPost.post.deleted).toBe(true);
await delay();
// TODO this doesn't work for some reason
// expect(betaPost.post.deleted).toBe(true);
// await delay();
// Undelete
let undeletedPost = await deletePost(alpha, false, postRes.post);
expect(undeletedPost.post.deleted).toBe(false);
await delay();
await delay(5000);
// Make sure lemmy beta sees post is undeleted
let betaPost2 = await getPost(beta, createFakeBetaPostToGetId);
@ -236,7 +237,7 @@ test('Remove a post from admin and community on different instance', async () =>
let removedPost = await removePost(alpha, true, postRes.post);
expect(removedPost.post.removed).toBe(true);
await delay();
await delay(5000);
// Make sure lemmy beta sees post is NOT removed
let createFakeBetaPostToGetId = (await createPost(beta, 2)).post.id - 1;
@ -263,7 +264,7 @@ test('Remove a post from admin and community on same instance', async () => {
// Get the id for beta
let createFakeBetaPostToGetId = (await createPost(beta, 2)).post.id - 1;
let betaPost = await getPost(beta, createFakeBetaPostToGetId);
await delay();
await delay(5000);
// The beta admin removes it (the community lives on beta)
let removePostRes = await removePost(beta, true, betaPost.post);

View File

@ -524,7 +524,7 @@ export async function followBeta(api: API): Promise<CommunityResponse> {
}
}
export const delay = (millis: number = 1000) =>
export const delay = (millis: number = 3000) =>
new Promise((resolve, _reject) => {
setTimeout(_ => resolve(), millis);
});