Adding a retry on a few fetches. (#4267)

format_check_test^2
Dessalines 6 months ago committed by GitHub
parent 59eef85bb7
commit ac209d58b4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -344,17 +344,26 @@ test("Federated comment like", async () => {
test("Reply to a comment from another instance, get notification", async () => { test("Reply to a comment from another instance, get notification", async () => {
await alpha.markAllAsRead(); await alpha.markAllAsRead();
let betaCommunity = (await resolveBetaCommunity(alpha)).community; let betaCommunity = (
await waitUntil(
() => resolveBetaCommunity(alpha),
c => !!c.community?.community.instance_id,
)
).community;
if (!betaCommunity) { if (!betaCommunity) {
throw "Missing beta community"; throw "Missing beta community";
} }
const postOnAlphaRes = await createPost(alpha, betaCommunity.community.id); const postOnAlphaRes = await createPost(alpha, betaCommunity.community.id);
// Create a root-level trunk-branch comment on alpha // Create a root-level trunk-branch comment on alpha
let commentRes = await createComment(alpha, postOnAlphaRes.post_view.post.id); let commentRes = await createComment(alpha, postOnAlphaRes.post_view.post.id);
// find that comment id on beta // find that comment id on beta
let betaComment = ( let betaComment = (
await resolveComment(beta, commentRes.comment_view.comment) await waitUntil(
() => resolveComment(beta, commentRes.comment_view.comment),
c => c.comment?.counts.score === 1,
)
).comment; ).comment;
if (!betaComment) { if (!betaComment) {
@ -405,7 +414,10 @@ test("Reply to a comment from another instance, get notification", async () => {
expect(alphaUnreadCountRes.replies).toBeGreaterThanOrEqual(1); expect(alphaUnreadCountRes.replies).toBeGreaterThanOrEqual(1);
// check inbox of replies on alpha, fetching read/unread both // check inbox of replies on alpha, fetching read/unread both
let alphaRepliesRes = await getReplies(alpha); let alphaRepliesRes = await waitUntil(
() => getReplies(alpha),
r => r.replies.length > 0,
);
const alphaReply = alphaRepliesRes.replies.find( const alphaReply = alphaRepliesRes.replies.find(
r => r.comment.id === alphaComment.comment.id, r => r.comment.id === alphaComment.comment.id,
); );

Loading…
Cancel
Save