From 60670c21ce222b859641e1769165d677e15aa6d2 Mon Sep 17 00:00:00 2001 From: Simon Backx Date: Mon, 30 Jan 2023 15:45:16 +0100 Subject: [PATCH] Fixed webmentions test awaiting events no issue The test was not waiting for dispatched events. --- ghost/core/test/e2e-api/webmentions/webmentions.test.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ghost/core/test/e2e-api/webmentions/webmentions.test.js b/ghost/core/test/e2e-api/webmentions/webmentions.test.js index 95ebdfc30b..37892752a3 100644 --- a/ghost/core/test/e2e-api/webmentions/webmentions.test.js +++ b/ghost/core/test/e2e-api/webmentions/webmentions.test.js @@ -4,6 +4,7 @@ const assert = require('assert'); const urlUtils = require('../../../core/shared/url-utils'); const nock = require('nock'); const jobsService = require('../../../core/server/services/jobs'); +const DomainEvents = require('@tryghost/domain-events/lib/DomainEvents'); describe('Webmentions (receiving)', function () { let agent; @@ -24,7 +25,8 @@ describe('Webmentions (receiving)', function () { emailMockReceiver = mockManager.mockMail(); }); - afterEach(function () { + afterEach(async function () { + await DomainEvents.allSettled(); mockManager.restore(); }); @@ -126,6 +128,7 @@ describe('Webmentions (receiving)', function () { .expectStatus(202); await processWebmentionJob; + await DomainEvents.allSettled(); const users = await models.User.findAll(); users.forEach(async (user) => { @@ -162,6 +165,7 @@ describe('Webmentions (receiving)', function () { .expectStatus(202); await processWebmentionJob; + await DomainEvents.allSettled(); emailMockReceiver.sentEmailCount(0); });