From 6161f949104fe03e097b6ed8189b5603b2add40a Mon Sep 17 00:00:00 2001 From: Hannah Wolfe Date: Wed, 21 Jun 2023 09:56:59 +0100 Subject: [PATCH] Updated to use assert/strict everywhere (#17047) refs: https://github.com/TryGhost/Toolbox/issues/595 We're rolling out new rules around the node assert library, the first of which is enforcing the use of assert/strict. This means we don't need to use the strict version of methods, as the standard version will work that way by default. This caught some gotchas in our existing usage of assert where the lack of strict mode had unexpected results: - Url matching needs to be done on `url.href` see https://github.com/TryGhost/Ghost/pull/17047/commits/aa58b354a40751326fe3c00902b202099b2223d2 - Null and undefined are not the same thing, there were a few cases of this being confused - Particularly questionable changes in [PostExporter tests](https://github.com/TryGhost/Ghost/pull/17047/commits/c1a468744beeca4c09ebfe4ac4f87fb3a685f25e) tracked [here](https://github.com/TryGhost/Team/issues/3505). - A typo see https://github.com/TryGhost/Ghost/pull/17047/commits/eaac9c293a87fe0c9646eb52f5f5ef3ecd6d56b0 Moving forward, using assert strict should help us to catch unexpected behaviour, particularly around nulls and undefineds during implementation. --- apps/signup-form/test/unit/hello.test.js | 2 +- .../test/adapter-cache-memory-ttl.test.js | 2 +- .../test/adapter-cache-redis.test.js | 2 +- ghost/admin-x-settings/test/hello.test.js | 2 +- .../test/AnnouncementBarSettings.test.js | 2 +- .../api-version-compatibility-service.test.js | 2 +- .../test/AudienceFeedbackService.test.js | 2 +- .../legacy-api-path-match.js | 2 +- .../test/e2e-api/admin/activity-feed.test.js | 2 +- .../test/e2e-api/admin/collections.test.js | 2 +- .../test/e2e-api/admin/email-previews.test.js | 2 +- ghost/core/test/e2e-api/admin/emails.test.js | 2 +- ghost/core/test/e2e-api/admin/images.test.js | 4 +- ghost/core/test/e2e-api/admin/members.test.js | 2 +- .../test/e2e-api/admin/newsletters.test.js | 2 +- .../test/e2e-api/admin/pages-bulk.test.js | 2 +- .../test/e2e-api/admin/posts-bulk.test.js | 2 +- .../core/test/e2e-api/admin/settings.test.js | 10 +-- ghost/core/test/e2e-api/admin/stats.test.js | 10 +-- ghost/core/test/e2e-api/admin/tiers.test.js | 2 +- ghost/core/test/e2e-api/content/pages.test.js | 2 +- ghost/core/test/e2e-api/content/posts.test.js | 5 +- ghost/core/test/e2e-api/content/tags.test.js | 2 +- .../e2e-api/members-comments/comments.test.js | 2 +- .../test/e2e-api/members/feedback.test.js | 2 +- .../core/test/e2e-api/members/signin.test.js | 2 +- .../test/e2e-api/members/webhooks.test.js | 2 +- .../e2e-api/webmentions/webmentions.test.js | 2 +- ghost/core/test/e2e-frontend/members.test.js | 2 +- .../e2e-server/1-options-requests.test.js | 2 +- .../test/e2e-server/click-tracking.test.js | 2 +- .../test/e2e-server/jobs/update-check.test.js | 2 +- .../test/e2e-server/services/mentions.test.js | 2 +- .../e2e-server/services/milestones.test.js | 2 +- .../core/test/integration/importer/v2.test.js | 2 +- .../email-service/batch-sending.test.js | 2 +- .../email-service/email-event-storage.test.js | 6 +- .../services/last-seen-at-updater.test.js | 2 +- .../mailgun-email-suppression-list.test.js | 2 +- .../services/members/clean-tokens.test.js | 2 +- .../api/admin/authentication.test.js | 2 +- .../api/admin/members-importer.test.js | 2 +- .../test/unit/api/cache-invalidation.test.js | 2 +- .../test/unit/frontend/helpers/date.test.js | 2 +- .../unit/frontend/helpers/utils/handlebars.js | 2 +- .../frontend/meta/generate-excerpt.test.js | 2 +- .../services/sitemap/generator.test.js | 2 +- .../frontend/services/sitemap/manager.test.js | 2 +- .../unit/server/adapters/cache/Cache.test.js | 2 +- .../unit/server/adapters/cache/Memory.test.js | 2 +- .../importer/importers/data/products.test.js | 2 +- .../core/test/unit/server/lib/events.test.js | 2 +- .../unit/server/models/base/relations.test.js | 2 +- .../models/email-spam-complaint-event.test.js | 2 +- .../test/unit/server/models/milestone.test.js | 2 +- .../server/models/single-use-token.test.js | 2 +- .../unit/server/models/suppression.test.js | 2 +- .../legacy-api-path-match.test.js | 2 +- .../mw-content-version.test.js | 2 +- .../mw-version-rewrites.test.js | 2 +- .../CollectionsServiceWrapper.test.js | 2 +- .../PostsDataRepositoryBookshelf.test.ts | 2 +- .../frontend-data-service.test.js | 2 +- .../frontend-data-service/index.test.js | 2 +- .../test/unit/server/services/limits.test.js | 2 +- .../server/services/mail/GhostMailer.test.js | 2 +- .../server/services/members/config.test.js | 2 +- .../services/mentions/ResourceService.test.js | 2 +- .../services/mentions/RoutingService.test.js | 2 +- .../BookshelfMilestoneRepository.test.js | 2 +- .../milestones/MilestoneQueries.test.js | 2 +- .../server/services/milestones/index.test.js | 2 +- .../server/services/newsletters/index.test.js | 2 +- .../services/newsletters/service.test.js | 2 +- .../server/services/oembed/nft-oembed.test.js | 2 +- .../services/oembed/twitter-embed.test.js | 2 +- .../segment/DomainEventsAnalytics.test.js | 2 +- .../segment/ModelEventsAnalytics.test.js | 2 +- .../server/services/segment/index.test.js | 2 +- .../settings/settings-bread-service.test.js | 2 +- .../slack-notifications/index.test.js | 4 +- .../server/services/themes/validate.test.js | 2 +- .../services/tiers/TierRepository.test.js | 2 +- .../server/services/url/Resources.test.js | 2 +- .../services/users/users-service.test.js | 2 +- .../services/webhooks/serialize.test.js | 2 +- .../server/services/webhooks/trigger.test.js | 2 +- ghost/core/test/unit/shared/sentry.test.js | 2 +- .../test/utils/e2e-framework-mock-manager.js | 2 +- ghost/domain-events/test/DomainEvents.test.js | 2 +- .../test/dynamic-routing-events.test.js | 2 +- .../test/lib/URLResourceUpdatedEvent.test.js | 2 +- .../test/email-content-generator.test.js | 2 +- ghost/email-events/test/index.test.js | 2 +- .../test/lib/EmailBouncedEvent.test.js | 2 +- .../test/lib/EmailDeliveredEvent.test.js | 2 +- .../test/lib/EmailOpenedEvent.test.js | 2 +- .../lib/EmailTemporaryBouncedEvent.test.js | 2 +- .../test/lib/EmailUnsubscribedEvent.test.js | 2 +- .../test/lib/SpamComplaintEvent.test.js | 2 +- .../test/batch-sending-service.test.js | 2 +- .../test/email-controller.test.js | 6 +- .../test/email-event-processor.test.js | 8 +- .../test/email-event-storage.test.js | 2 +- .../email-service/test/email-renderer.test.js | 2 +- .../email-service/test/email-service.test.js | 78 +++++++++---------- .../test/mailgun-email-provider.test.js | 4 +- .../test/sending-service.test.js | 2 +- .../lib/email-suppression-list.js | 2 +- .../email-suppression-list/test/index.test.js | 2 +- .../test/lib/email-suppression-list.test.js | 2 +- .../test/EventAwareCacheWrapper.test.js | 2 +- .../test/ExternalMediaInliner.test.js | 2 +- .../test/extract-api-key.test.js | 2 +- .../test/html-to-plaintext.test.js | 2 +- ghost/i18n/test/i18n.test.js | 2 +- .../test/ImporterContentFileHandler.test.js | 2 +- .../test/importer-revue.test.js | 2 +- ghost/job-manager/test/job-manager.test.js | 2 +- .../test/LinkRedirectsService.test.js | 14 ++-- ghost/link-replacer/test/LinkReplacer.test.js | 2 +- .../test/LinkClickTrackingService.test.js | 4 +- ghost/magic-link/test/index.test.js | 2 +- .../test/mailgun-client.test.js | 10 +-- .../test/outbound-link-tagger.test.js | 2 +- .../test/unit/lib/repositories/member.test.js | 2 +- .../unit/lib/repositories/product.test.js | 2 +- .../test/unit/lib/services/token.test.js | 2 +- ghost/members-csv/test/parse.test.js | 2 +- ghost/members-csv/test/unparse.test.js | 2 +- .../test/last-seen-at-updater.test.js | 2 +- ghost/members-importer/test/importer.test.js | 4 +- .../test/InMemoryMilestoneRepository.test.js | 2 +- ghost/milestones/test/Milestone.test.js | 2 +- .../milestones/test/MilestonesService.test.js | 2 +- .../test/mw-api-version-mismatch.test.js | 2 +- .../test/mw-error-handler.test.js | 2 +- ghost/mw-vhost/test/vhost.test.js | 2 +- ghost/oembed-service/test/hello.test.js | 2 +- ghost/payments/test/lib/payments.test.js | 6 +- .../posts-service/test/PostsExporter.test.js | 19 ++--- ghost/posts-service/test/PostsService.test.js | 2 +- .../test/SlackNotifications.test.js | 2 +- .../test/SlackNotificationsService.test.js | 2 +- ghost/stats-service/test/lib/members.test.js | 2 +- .../stats-service/test/lib/referrers.test.js | 4 +- ghost/stats-service/test/lib/stats.test.js | 2 +- .../test/lib/subscriptions.test.js | 2 +- ghost/stripe/test/unit/lib/Migrations.test.js | 2 +- ghost/tiers/test/Tier.test.js | 4 +- ghost/tiers/test/TiersAPI.test.js | 2 +- ghost/tiers/test/index.test.js | 2 +- .../test/update-check-service.test.js | 2 +- .../test/verification-trigger.test.js | 2 +- .../version-notificatons-data-service.test.js | 2 +- .../test/InMemoryMentionRepository.test.js | 2 +- ghost/webmentions/test/Mention.test.js | 2 +- .../test/MentionDiscoveryService.test.js | 10 +-- .../test/MentionSendingService.test.js | 32 ++++---- ghost/webmentions/test/MentionsAPI.test.js | 2 +- 160 files changed, 262 insertions(+), 260 deletions(-) diff --git a/apps/signup-form/test/unit/hello.test.js b/apps/signup-form/test/unit/hello.test.js index d3fca19a16..3a89a84858 100644 --- a/apps/signup-form/test/unit/hello.test.js +++ b/apps/signup-form/test/unit/hello.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); describe('Hello world', function () { it('Runs a test', function () { diff --git a/ghost/adapter-cache-memory-ttl/test/adapter-cache-memory-ttl.test.js b/ghost/adapter-cache-memory-ttl/test/adapter-cache-memory-ttl.test.js index d773619d5f..44917a2379 100644 --- a/ghost/adapter-cache-memory-ttl/test/adapter-cache-memory-ttl.test.js +++ b/ghost/adapter-cache-memory-ttl/test/adapter-cache-memory-ttl.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const MemoryTTLCache = require('../index'); const sleep = ms => ( diff --git a/ghost/adapter-cache-redis/test/adapter-cache-redis.test.js b/ghost/adapter-cache-redis/test/adapter-cache-redis.test.js index eb26075565..5de91a103c 100644 --- a/ghost/adapter-cache-redis/test/adapter-cache-redis.test.js +++ b/ghost/adapter-cache-redis/test/adapter-cache-redis.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const RedisCache = require('../index'); diff --git a/ghost/admin-x-settings/test/hello.test.js b/ghost/admin-x-settings/test/hello.test.js index 3224ab57bf..d13fa290bb 100644 --- a/ghost/admin-x-settings/test/hello.test.js +++ b/ghost/admin-x-settings/test/hello.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); describe('Hello world', function () { it('Runs a test', function () { diff --git a/ghost/announcement-bar-settings/test/AnnouncementBarSettings.test.js b/ghost/announcement-bar-settings/test/AnnouncementBarSettings.test.js index 4d12e47dea..7a623a933e 100644 --- a/ghost/announcement-bar-settings/test/AnnouncementBarSettings.test.js +++ b/ghost/announcement-bar-settings/test/AnnouncementBarSettings.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const AnnouncementBarSettings = require('../index'); describe('AnnouncementBarSettings', function () { diff --git a/ghost/api-version-compatibility-service/test/api-version-compatibility-service.test.js b/ghost/api-version-compatibility-service/test/api-version-compatibility-service.test.js index 21ace5388e..c9087601cc 100644 --- a/ghost/api-version-compatibility-service/test/api-version-compatibility-service.test.js +++ b/ghost/api-version-compatibility-service/test/api-version-compatibility-service.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const APIVersionCompatibilityService = require('../index'); diff --git a/ghost/audience-feedback/test/AudienceFeedbackService.test.js b/ghost/audience-feedback/test/AudienceFeedbackService.test.js index 92c2c85b19..8a85d54262 100644 --- a/ghost/audience-feedback/test/AudienceFeedbackService.test.js +++ b/ghost/audience-feedback/test/AudienceFeedbackService.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const {AudienceFeedbackService} = require('../index'); describe('audienceFeedbackService', function () { diff --git a/ghost/core/core/server/services/api-version-compatibility/legacy-api-path-match.js b/ghost/core/core/server/services/api-version-compatibility/legacy-api-path-match.js index 70222a5c45..6572bb1295 100644 --- a/ghost/core/core/server/services/api-version-compatibility/legacy-api-path-match.js +++ b/ghost/core/core/server/services/api-version-compatibility/legacy-api-path-match.js @@ -15,7 +15,7 @@ module.exports = (url) => { let {version, api} = pathMatch(apiRouteMatcher)(urlToMatch); - if (version === [null]) { + if (version === undefined) { version = null; } diff --git a/ghost/core/test/e2e-api/admin/activity-feed.test.js b/ghost/core/test/e2e-api/admin/activity-feed.test.js index a8f20590f1..13c2fe2396 100644 --- a/ghost/core/test/e2e-api/admin/activity-feed.test.js +++ b/ghost/core/test/e2e-api/admin/activity-feed.test.js @@ -1,7 +1,7 @@ const {agentProvider, mockManager, fixtureManager, matchers} = require('../../utils/e2e-framework'); const {anyEtag, anyErrorId, anyObjectId, anyContentLength, anyContentVersion, anyUuid, anyISODate, anyString, anyObject, anyNumber} = matchers; -const assert = require('assert'); +const assert = require('assert/strict'); const moment = require('moment'); const sinon = require('sinon'); const logging = require('@tryghost/logging'); diff --git a/ghost/core/test/e2e-api/admin/collections.test.js b/ghost/core/test/e2e-api/admin/collections.test.js index d274cd21bc..67d7592a94 100644 --- a/ghost/core/test/e2e-api/admin/collections.test.js +++ b/ghost/core/test/e2e-api/admin/collections.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const { agentProvider, fixtureManager, diff --git a/ghost/core/test/e2e-api/admin/email-previews.test.js b/ghost/core/test/e2e-api/admin/email-previews.test.js index 3e9180b6d3..a3d66da487 100644 --- a/ghost/core/test/e2e-api/admin/email-previews.test.js +++ b/ghost/core/test/e2e-api/admin/email-previews.test.js @@ -1,6 +1,6 @@ const {agentProvider, fixtureManager, matchers, mockManager} = require('../../utils/e2e-framework'); const {anyEtag, anyErrorId, anyContentVersion, anyString} = matchers; -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const escapeRegExp = require('lodash/escapeRegExp'); const should = require('should'); diff --git a/ghost/core/test/e2e-api/admin/emails.test.js b/ghost/core/test/e2e-api/admin/emails.test.js index 372a38c971..7f49929930 100644 --- a/ghost/core/test/e2e-api/admin/emails.test.js +++ b/ghost/core/test/e2e-api/admin/emails.test.js @@ -1,6 +1,6 @@ const {agentProvider, fixtureManager, matchers, mockManager} = require('../../utils/e2e-framework'); const {nullable, anyContentVersion, anyEtag, anyObjectId, anyUuid, anyISODateTime, anyString} = matchers; -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const jobManager = require('../../../core/server/services/jobs/job-service'); const models = require('../../../core/server/models'); diff --git a/ghost/core/test/e2e-api/admin/images.test.js b/ghost/core/test/e2e-api/admin/images.test.js index fc6bab396b..1df51c5e7e 100644 --- a/ghost/core/test/e2e-api/admin/images.test.js +++ b/ghost/core/test/e2e-api/admin/images.test.js @@ -2,7 +2,7 @@ const {agentProvider, fixtureManager, matchers} = require('../../utils/e2e-frame const FormData = require('form-data'); const p = require('path'); const {promises: fs} = require('fs'); -const assert = require('assert'); +const assert = require('assert/strict'); const config = require('../../../core/shared/config'); const urlUtils = require('../../../core/shared/url-utils'); const imageTransform = require('@tryghost/image-transform'); @@ -59,7 +59,7 @@ const uploadImageCheck = async ({path, filename, contentType, expectedFileName, expectedFileName = expectedFileName || filename; assert.match(body.images[0].url, new RegExp(`${urlUtils.urlFor('home', true)}content/images/\\d+/\\d+/${expectedFileName}`)); - assert.equal(body.images[0].ref, ref); + assert.equal(body.images[0].ref, ref === undefined ? null : ref); const relativePath = body.images[0].url.replace(urlUtils.urlFor('home', true), '/'); const filePath = config.getContentPath('images') + relativePath.replace('/content/images/', ''); diff --git a/ghost/core/test/e2e-api/admin/members.test.js b/ghost/core/test/e2e-api/admin/members.test.js index 8cecf40888..82ada71cd8 100644 --- a/ghost/core/test/e2e-api/admin/members.test.js +++ b/ghost/core/test/e2e-api/admin/members.test.js @@ -3,7 +3,7 @@ const {anyContentVersion, anyEtag, anyObjectId, anyUuid, anyISODateTime, anyISOD const {queryStringToken} = regexes; const ObjectId = require('bson-objectid').default; -const assert = require('assert'); +const assert = require('assert/strict'); const nock = require('nock'); const sinon = require('sinon'); const should = require('should'); diff --git a/ghost/core/test/e2e-api/admin/newsletters.test.js b/ghost/core/test/e2e-api/admin/newsletters.test.js index 09805d67cb..264a3d3f1e 100644 --- a/ghost/core/test/e2e-api/admin/newsletters.test.js +++ b/ghost/core/test/e2e-api/admin/newsletters.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const {agentProvider, mockManager, fixtureManager, configUtils, dbUtils, matchers, regexes} = require('../../utils/e2e-framework'); const {anyContentVersion, anyEtag, anyObjectId, anyUuid, anyISODateTime, anyLocationFor, anyNumber} = matchers; diff --git a/ghost/core/test/e2e-api/admin/pages-bulk.test.js b/ghost/core/test/e2e-api/admin/pages-bulk.test.js index 9619b413be..d881459051 100644 --- a/ghost/core/test/e2e-api/admin/pages-bulk.test.js +++ b/ghost/core/test/e2e-api/admin/pages-bulk.test.js @@ -1,6 +1,6 @@ const {agentProvider, fixtureManager, mockManager} = require('../../utils/e2e-framework'); const models = require('../../../core/server/models'); -const assert = require('assert'); +const assert = require('assert/strict'); const forcePageFilter = (filter) => { if (filter) { diff --git a/ghost/core/test/e2e-api/admin/posts-bulk.test.js b/ghost/core/test/e2e-api/admin/posts-bulk.test.js index 7f812adacd..c883f6ebcb 100644 --- a/ghost/core/test/e2e-api/admin/posts-bulk.test.js +++ b/ghost/core/test/e2e-api/admin/posts-bulk.test.js @@ -1,6 +1,6 @@ const {agentProvider, fixtureManager, mockManager} = require('../../utils/e2e-framework'); const models = require('../../../core/server/models'); -const assert = require('assert'); +const assert = require('assert/strict'); describe('Posts Bulk API', function () { let agent; diff --git a/ghost/core/test/e2e-api/admin/settings.test.js b/ghost/core/test/e2e-api/admin/settings.test.js index ff63285f4e..030d4d939d 100644 --- a/ghost/core/test/e2e-api/admin/settings.test.js +++ b/ghost/core/test/e2e-api/admin/settings.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const logging = require('@tryghost/logging'); const SingleUseTokenProvider = require('../../../core/server/services/members/SingleUseTokenProvider'); @@ -248,7 +248,7 @@ describe('Settings API', function () { }) .expect(({body}) => { const emailVerificationRequired = body.settings.find(setting => setting.key === 'email_verification_required'); - assert.strictEqual(emailVerificationRequired.value, false); + assert.equal(emailVerificationRequired.value, false); }); mockManager.assert.sentEmailCount(0); }); @@ -270,7 +270,7 @@ describe('Settings API', function () { }) .expect(({body}) => { const membersSupportAddress = body.settings.find(setting => setting.key === 'members_support_address'); - assert.strictEqual(membersSupportAddress.value, 'noreply'); + assert.equal(membersSupportAddress.value, 'noreply'); assert.deepEqual(body.meta, { sent_email_verification: ['members_support_address'] @@ -306,7 +306,7 @@ describe('Settings API', function () { }) .expect(({body}) => { const membersSupportAddress = body.settings.find(setting => setting.key === 'members_support_address'); - assert.strictEqual(membersSupportAddress.value, 'support@example.com'); + assert.equal(membersSupportAddress.value, 'support@example.com'); assert.deepEqual(body.meta, {}); }); @@ -397,7 +397,7 @@ describe('Settings API', function () { }) .expect(({body}) => { const membersSupportAddress = body.settings.find(setting => setting.key === 'members_support_address'); - assert.strictEqual(membersSupportAddress.value, 'support@example.com'); + assert.equal(membersSupportAddress.value, 'support@example.com'); }); mockManager.assert.sentEmailCount(0); diff --git a/ghost/core/test/e2e-api/admin/stats.test.js b/ghost/core/test/e2e-api/admin/stats.test.js index e55f8cfcba..09f8ac84b1 100644 --- a/ghost/core/test/e2e-api/admin/stats.test.js +++ b/ghost/core/test/e2e-api/admin/stats.test.js @@ -1,7 +1,7 @@ const {agentProvider, fixtureManager, matchers, mockManager} = require('../../utils/e2e-framework'); const {mockStripe, stripeMocker} = require('../../utils/e2e-framework-mock-manager'); const {anyContentVersion, anyEtag, anyISODate, anyObjectId} = matchers; -const assert = require('assert'); +const assert = require('assert/strict'); let agent; @@ -104,7 +104,7 @@ describe('Stats API', function () { etag: anyEtag }) .expect(({body}) => { - assert.deepStrictEqual(body, before, 'A free trial should not be counted as a paid subscriber'); + assert.deepEqual(body, before, 'A free trial should not be counted as a paid subscriber'); }); // Activate the subscription @@ -124,7 +124,7 @@ describe('Stats API', function () { etag: anyEtag }) .expect(({body}) => { - assert.notDeepStrictEqual(body, before, 'The stats should change after a free trial is activated'); + assert.notDeepEqual(body, before, 'The stats should change after a free trial is activated'); }); }); @@ -151,7 +151,7 @@ describe('Stats API', function () { etag: anyEtag }) .expect(({body}) => { - assert.deepStrictEqual(body, before, 'An incomplete subscription should not be counted as a paid subscriber'); + assert.deepEqual(body, before, 'An incomplete subscription should not be counted as a paid subscriber'); }); // Activate the subscription @@ -170,7 +170,7 @@ describe('Stats API', function () { etag: anyEtag }) .expect(({body}) => { - assert.notDeepStrictEqual(body, before, 'The stats should change after an incomplete subscription is activated'); + assert.notDeepEqual(body, before, 'The stats should change after an incomplete subscription is activated'); }); }); }); diff --git a/ghost/core/test/e2e-api/admin/tiers.test.js b/ghost/core/test/e2e-api/admin/tiers.test.js index 77a0cd59b5..8d99622c5a 100644 --- a/ghost/core/test/e2e-api/admin/tiers.test.js +++ b/ghost/core/test/e2e-api/admin/tiers.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const { agentProvider, fixtureManager, diff --git a/ghost/core/test/e2e-api/content/pages.test.js b/ghost/core/test/e2e-api/content/pages.test.js index 19d591ded9..b7770d3533 100644 --- a/ghost/core/test/e2e-api/content/pages.test.js +++ b/ghost/core/test/e2e-api/content/pages.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const moment = require('moment'); const testUtils = require('../../utils'); diff --git a/ghost/core/test/e2e-api/content/posts.test.js b/ghost/core/test/e2e-api/content/posts.test.js index 42e591560d..a45702ba03 100644 --- a/ghost/core/test/e2e-api/content/posts.test.js +++ b/ghost/core/test/e2e-api/content/posts.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const cheerio = require('cheerio'); const moment = require('moment'); const testUtils = require('../../utils'); @@ -111,7 +111,8 @@ describe('Posts Content API', function () { } else { const tag = post.tags .map(t => t.slug) - .filter(s => s === 'kitchen-sink'); + .filter(s => s === 'kitchen-sink') + .pop(); assert.equal(tag, 'kitchen-sink', `Each post must either be featured or have the tag 'kitchen-sink'`); } }); diff --git a/ghost/core/test/e2e-api/content/tags.test.js b/ghost/core/test/e2e-api/content/tags.test.js index 7712e16cbd..5e098aacad 100644 --- a/ghost/core/test/e2e-api/content/tags.test.js +++ b/ghost/core/test/e2e-api/content/tags.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const should = require('should'); const supertest = require('supertest'); const _ = require('lodash'); diff --git a/ghost/core/test/e2e-api/members-comments/comments.test.js b/ghost/core/test/e2e-api/members-comments/comments.test.js index 422fbe8368..4444f6f90e 100644 --- a/ghost/core/test/e2e-api/members-comments/comments.test.js +++ b/ghost/core/test/e2e-api/members-comments/comments.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const {agentProvider, mockManager, fixtureManager, matchers, configUtils} = require('../../utils/e2e-framework'); const {anyEtag, anyObjectId, anyLocationFor, anyISODateTime, anyErrorId, anyUuid, anyNumber, anyBoolean} = matchers; const should = require('should'); diff --git a/ghost/core/test/e2e-api/members/feedback.test.js b/ghost/core/test/e2e-api/members/feedback.test.js index fcda365dcf..490db7954e 100644 --- a/ghost/core/test/e2e-api/members/feedback.test.js +++ b/ghost/core/test/e2e-api/members/feedback.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const {agentProvider, mockManager, fixtureManager, matchers, configUtils} = require('../../utils/e2e-framework'); const {anyEtag, anyObjectId, anyLocationFor, anyErrorId} = matchers; const models = require('../../../core/server/models'); diff --git a/ghost/core/test/e2e-api/members/signin.test.js b/ghost/core/test/e2e-api/members/signin.test.js index 3bbf2b01d5..7ef02f0e30 100644 --- a/ghost/core/test/e2e-api/members/signin.test.js +++ b/ghost/core/test/e2e-api/members/signin.test.js @@ -1,6 +1,6 @@ const {agentProvider, mockManager, fixtureManager, configUtils, resetRateLimits, dbUtils} = require('../../utils/e2e-framework'); const models = require('../../../core/server/models'); -const assert = require('assert'); +const assert = require('assert/strict'); require('should'); const sinon = require('sinon'); diff --git a/ghost/core/test/e2e-api/members/webhooks.test.js b/ghost/core/test/e2e-api/members/webhooks.test.js index 7087508337..d91b32ba1f 100644 --- a/ghost/core/test/e2e-api/members/webhooks.test.js +++ b/ghost/core/test/e2e-api/members/webhooks.test.js @@ -1,5 +1,5 @@ const crypto = require('crypto'); -const assert = require('assert'); +const assert = require('assert/strict'); const nock = require('nock'); const should = require('should'); const stripe = require('stripe'); diff --git a/ghost/core/test/e2e-api/webmentions/webmentions.test.js b/ghost/core/test/e2e-api/webmentions/webmentions.test.js index 2b171a9e10..e804cb4594 100644 --- a/ghost/core/test/e2e-api/webmentions/webmentions.test.js +++ b/ghost/core/test/e2e-api/webmentions/webmentions.test.js @@ -6,7 +6,7 @@ const { configUtils } = require('../../utils/e2e-framework'); const models = require('../../../core/server/models'); -const assert = require('assert'); +const assert = require('assert/strict'); const urlUtils = require('../../../core/shared/url-utils'); const nock = require('nock'); const jobsService = require('../../../core/server/services/mentions-jobs'); diff --git a/ghost/core/test/e2e-frontend/members.test.js b/ghost/core/test/e2e-frontend/members.test.js index 0bd736ec52..9fcdc58773 100644 --- a/ghost/core/test/e2e-frontend/members.test.js +++ b/ghost/core/test/e2e-frontend/members.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const should = require('should'); const sinon = require('sinon'); const supertest = require('supertest'); diff --git a/ghost/core/test/e2e-server/1-options-requests.test.js b/ghost/core/test/e2e-server/1-options-requests.test.js index a0ee5949d2..60c1ed9ca0 100644 --- a/ghost/core/test/e2e-server/1-options-requests.test.js +++ b/ghost/core/test/e2e-server/1-options-requests.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const {agentProvider, matchers} = require('../utils/e2e-framework'); const {anyContentVersion} = matchers; const config = require('../../core/shared/config'); diff --git a/ghost/core/test/e2e-server/click-tracking.test.js b/ghost/core/test/e2e-server/click-tracking.test.js index c9cec5d651..5a573f1ddb 100644 --- a/ghost/core/test/e2e-server/click-tracking.test.js +++ b/ghost/core/test/e2e-server/click-tracking.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const fetch = require('node-fetch').default; const {agentProvider, mockManager, fixtureManager} = require('../utils/e2e-framework'); const urlUtils = require('../../core/shared/url-utils'); diff --git a/ghost/core/test/e2e-server/jobs/update-check.test.js b/ghost/core/test/e2e-server/jobs/update-check.test.js index df0d857328..e1bb4161b9 100644 --- a/ghost/core/test/e2e-server/jobs/update-check.test.js +++ b/ghost/core/test/e2e-server/jobs/update-check.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const http = require('http'); const path = require('path'); diff --git a/ghost/core/test/e2e-server/services/mentions.test.js b/ghost/core/test/e2e-server/services/mentions.test.js index 3465ae8a7e..234f17077b 100644 --- a/ghost/core/test/e2e-server/services/mentions.test.js +++ b/ghost/core/test/e2e-server/services/mentions.test.js @@ -1,6 +1,6 @@ const {agentProvider, fixtureManager, mockManager} = require('../../utils/e2e-framework'); const nock = require('nock'); -const assert = require('assert'); +const assert = require('assert/strict'); const markdownToMobiledoc = require('../../utils/fixtures/data-generator').markdownToMobiledoc; const jobsService = require('../../../core/server/services/mentions-jobs'); diff --git a/ghost/core/test/e2e-server/services/milestones.test.js b/ghost/core/test/e2e-server/services/milestones.test.js index 7126f7ad36..03c018f22b 100644 --- a/ghost/core/test/e2e-server/services/milestones.test.js +++ b/ghost/core/test/e2e-server/services/milestones.test.js @@ -1,5 +1,5 @@ const {agentProvider, fixtureManager, mockManager, configUtils} = require('../../utils/e2e-framework'); -const assert = require('assert'); +const assert = require('assert/strict'); const nock = require('nock'); const sinon = require('sinon'); const models = require('../../../core/server/models'); diff --git a/ghost/core/test/integration/importer/v2.test.js b/ghost/core/test/integration/importer/v2.test.js index def19dd886..77d8ba40b7 100644 --- a/ghost/core/test/integration/importer/v2.test.js +++ b/ghost/core/test/integration/importer/v2.test.js @@ -4,7 +4,7 @@ const testUtils = require('../../utils'); const Promise = require('bluebird'); const moment = require('moment-timezone'); const ObjectId = require('bson-objectid').default; -const assert = require('assert'); +const assert = require('assert/strict'); const _ = require('lodash'); const validator = require('@tryghost/validator'); diff --git a/ghost/core/test/integration/services/email-service/batch-sending.test.js b/ghost/core/test/integration/services/email-service/batch-sending.test.js index 35ee4dc26b..c8384ebdb9 100644 --- a/ghost/core/test/integration/services/email-service/batch-sending.test.js +++ b/ghost/core/test/integration/services/email-service/batch-sending.test.js @@ -3,7 +3,7 @@ const moment = require('moment'); const ObjectId = require('bson-objectid').default; const models = require('../../../../core/server/models'); const sinon = require('sinon'); -const assert = require('assert'); +const assert = require('assert/strict'); const jobManager = require('../../../../core/server/services/jobs/job-service'); const _ = require('lodash'); const {MailgunEmailProvider} = require('@tryghost/email-service'); diff --git a/ghost/core/test/integration/services/email-service/email-event-storage.test.js b/ghost/core/test/integration/services/email-service/email-event-storage.test.js index 3f6ac34abd..186baa24d9 100644 --- a/ghost/core/test/integration/services/email-service/email-event-storage.test.js +++ b/ghost/core/test/integration/services/email-service/email-event-storage.test.js @@ -1,6 +1,6 @@ const sinon = require('sinon'); const {agentProvider, fixtureManager} = require('../../../utils/e2e-framework'); -const assert = require('assert'); +const assert = require('assert/strict'); const MailgunClient = require('@tryghost/mailgun-client'); const DomainEvents = require('@tryghost/domain-events'); const emailAnalytics = require('../../../../core/server/services/email-analytics'); @@ -462,7 +462,7 @@ describe('EmailEventStorage', function () { // Message and code not changed assert.equal(permanentFailures.models[0].get('message'), 'Not delivering to previously bounced address'); assert.equal(permanentFailures.models[0].get('code'), 605); - assert.equal(permanentFailures.models[0].get('enhanded_code'), null); + assert.equal(permanentFailures.models[0].get('enhanced_code'), null); assert.notEqual(permanentFailures.models[0].get('failed_at').toUTCString(), timestamp.toUTCString()); }); @@ -997,7 +997,7 @@ describe('EmailEventStorage', function () { // Check not unsubscribed const {body: {events: eventsBefore}} = await agent.get(eventsURI); const existingSpamEvent = eventsBefore.find(event => event.type === 'email_complaint_event'); - assert.equal(existingSpamEvent, null, 'This test requires a member that does not have a spam event'); + assert.equal(existingSpamEvent, undefined, 'This test requires a member that does not have a spam event'); events = [{ event: 'complained', diff --git a/ghost/core/test/integration/services/last-seen-at-updater.test.js b/ghost/core/test/integration/services/last-seen-at-updater.test.js index fc7f3bcc08..f472674ef5 100644 --- a/ghost/core/test/integration/services/last-seen-at-updater.test.js +++ b/ghost/core/test/integration/services/last-seen-at-updater.test.js @@ -1,7 +1,7 @@ require('should'); const {agentProvider, fixtureManager, mockManager} = require('../../utils/e2e-framework'); const models = require('../../../core/server/models'); -const assert = require('assert'); +const assert = require('assert/strict'); let agent; describe('Last Seen At Updater', function () { diff --git a/ghost/core/test/integration/services/mailgun-email-suppression-list.test.js b/ghost/core/test/integration/services/mailgun-email-suppression-list.test.js index cc89816e19..6d6addb6aa 100644 --- a/ghost/core/test/integration/services/mailgun-email-suppression-list.test.js +++ b/ghost/core/test/integration/services/mailgun-email-suppression-list.test.js @@ -1,6 +1,6 @@ const sinon = require('sinon'); const {agentProvider, fixtureManager} = require('../../utils/e2e-framework'); -const assert = require('assert'); +const assert = require('assert/strict'); const MailgunClient = require('@tryghost/mailgun-client'); const DomainEvents = require('@tryghost/domain-events'); const emailAnalytics = require('../../../core/server/services/email-analytics'); diff --git a/ghost/core/test/integration/services/members/clean-tokens.test.js b/ghost/core/test/integration/services/members/clean-tokens.test.js index 06106ceb90..5ee9a563bc 100644 --- a/ghost/core/test/integration/services/members/clean-tokens.test.js +++ b/ghost/core/test/integration/services/members/clean-tokens.test.js @@ -1,6 +1,6 @@ const sinon = require('sinon'); const {agentProvider, fixtureManager} = require('../../../utils/e2e-framework'); -const assert = require('assert'); +const assert = require('assert/strict'); const models = require('../../../../core/server/models'); describe('Job: Clean tokens', function () { diff --git a/ghost/core/test/regression/api/admin/authentication.test.js b/ghost/core/test/regression/api/admin/authentication.test.js index a30e96f5f0..27355885f4 100644 --- a/ghost/core/test/regression/api/admin/authentication.test.js +++ b/ghost/core/test/regression/api/admin/authentication.test.js @@ -1,5 +1,5 @@ const nock = require('nock'); -const assert = require('assert'); +const assert = require('assert/strict'); const {agentProvider, mockManager, fixtureManager, matchers} = require('../../../utils/e2e-framework'); const {anyContentVersion, anyEtag, anyISODateTime, anyErrorId} = matchers; diff --git a/ghost/core/test/regression/api/admin/members-importer.test.js b/ghost/core/test/regression/api/admin/members-importer.test.js index 77282ac8c5..bd5ec8e593 100644 --- a/ghost/core/test/regression/api/admin/members-importer.test.js +++ b/ghost/core/test/regression/api/admin/members-importer.test.js @@ -10,7 +10,7 @@ const models = require('../../../../core/server/models'); const jobManager = require('../../../../core/server/services/jobs/job-service'); const {mockManager} = require('../../../utils/e2e-framework'); -const assert = require('assert'); +const assert = require('assert/strict'); let request; diff --git a/ghost/core/test/unit/api/cache-invalidation.test.js b/ghost/core/test/unit/api/cache-invalidation.test.js index a767f1c346..33107e91e5 100644 --- a/ghost/core/test/unit/api/cache-invalidation.test.js +++ b/ghost/core/test/unit/api/cache-invalidation.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const path = require('path'); const glob = require('glob'); diff --git a/ghost/core/test/unit/frontend/helpers/date.test.js b/ghost/core/test/unit/frontend/helpers/date.test.js index 8bfce4f4ce..0cbf87016b 100644 --- a/ghost/core/test/unit/frontend/helpers/date.test.js +++ b/ghost/core/test/unit/frontend/helpers/date.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const should = require('should'); diff --git a/ghost/core/test/unit/frontend/helpers/utils/handlebars.js b/ghost/core/test/unit/frontend/helpers/utils/handlebars.js index 2bf635ed27..5d2dd0cddc 100644 --- a/ghost/core/test/unit/frontend/helpers/utils/handlebars.js +++ b/ghost/core/test/unit/frontend/helpers/utils/handlebars.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const handlebars = require('../../../../../core/frontend/services/theme-engine/engine').handlebars; module.exports.shouldCompileToExpected = (templateString, hash, expected) => { diff --git a/ghost/core/test/unit/frontend/meta/generate-excerpt.test.js b/ghost/core/test/unit/frontend/meta/generate-excerpt.test.js index ec378407d3..0b261cd1b0 100644 --- a/ghost/core/test/unit/frontend/meta/generate-excerpt.test.js +++ b/ghost/core/test/unit/frontend/meta/generate-excerpt.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const generateExcerpt = require('../../../../core/frontend/meta/generate-excerpt'); describe('generateExcerpt', function () { diff --git a/ghost/core/test/unit/frontend/services/sitemap/generator.test.js b/ghost/core/test/unit/frontend/services/sitemap/generator.test.js index 30a74a2018..85e2f27b78 100644 --- a/ghost/core/test/unit/frontend/services/sitemap/generator.test.js +++ b/ghost/core/test/unit/frontend/services/sitemap/generator.test.js @@ -3,7 +3,7 @@ const sinon = require('sinon'); const ObjectId = require('bson-objectid').default; const _ = require('lodash'); const moment = require('moment'); -const assert = require('assert'); +const assert = require('assert/strict'); const testUtils = require('../../../../utils'); const urlUtils = require('../../../../../core/shared/url-utils'); const IndexGenerator = require('../../../../../core/frontend/services/sitemap/SiteMapIndexGenerator'); diff --git a/ghost/core/test/unit/frontend/services/sitemap/manager.test.js b/ghost/core/test/unit/frontend/services/sitemap/manager.test.js index 21f6519c26..317b531f1e 100644 --- a/ghost/core/test/unit/frontend/services/sitemap/manager.test.js +++ b/ghost/core/test/unit/frontend/services/sitemap/manager.test.js @@ -1,6 +1,6 @@ const should = require('should'); const sinon = require('sinon'); -const assert = require('assert'); +const assert = require('assert/strict'); // Stuff we are testing const DomainEvents = require('@tryghost/domain-events'); diff --git a/ghost/core/test/unit/server/adapters/cache/Cache.test.js b/ghost/core/test/unit/server/adapters/cache/Cache.test.js index 0f0cb04716..40fded6b9d 100644 --- a/ghost/core/test/unit/server/adapters/cache/Cache.test.js +++ b/ghost/core/test/unit/server/adapters/cache/Cache.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const {getCache} = require('../../../../../core/server/adapters/cache'); const MemoryCache = require('../../../../../core/server/adapters/cache/MemoryCache'); diff --git a/ghost/core/test/unit/server/adapters/cache/Memory.test.js b/ghost/core/test/unit/server/adapters/cache/Memory.test.js index 94bb1c048f..83eee6b2d2 100644 --- a/ghost/core/test/unit/server/adapters/cache/Memory.test.js +++ b/ghost/core/test/unit/server/adapters/cache/Memory.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const MemoryCache = require('../../../../../core/server/adapters/cache/MemoryCache'); diff --git a/ghost/core/test/unit/server/data/importer/importers/data/products.test.js b/ghost/core/test/unit/server/data/importer/importers/data/products.test.js index c9949bd2be..7a1eab7284 100644 --- a/ghost/core/test/unit/server/data/importer/importers/data/products.test.js +++ b/ghost/core/test/unit/server/data/importer/importers/data/products.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const ProductsImporter = require('../../../../../../../core/server/data/importer/importers/data/ProductsImporter'); const fakeProducts = [{ diff --git a/ghost/core/test/unit/server/lib/events.test.js b/ghost/core/test/unit/server/lib/events.test.js index ee65d13132..4d4aa04d66 100644 --- a/ghost/core/test/unit/server/lib/events.test.js +++ b/ghost/core/test/unit/server/lib/events.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const events = require('../../../../core/server/lib/common/events'); describe('Events', function () { diff --git a/ghost/core/test/unit/server/models/base/relations.test.js b/ghost/core/test/unit/server/models/base/relations.test.js index d7550f8002..9ad002ffcf 100644 --- a/ghost/core/test/unit/server/models/base/relations.test.js +++ b/ghost/core/test/unit/server/models/base/relations.test.js @@ -1,7 +1,7 @@ const should = require('should'); const sinon = require('sinon'); const models = require('../../../../../core/server/models'); -const assert = require('assert'); +const assert = require('assert/strict'); describe('Models: getLazyRelation', function () { before(function () { diff --git a/ghost/core/test/unit/server/models/email-spam-complaint-event.test.js b/ghost/core/test/unit/server/models/email-spam-complaint-event.test.js index bbb00b90b0..6068fc80a4 100644 --- a/ghost/core/test/unit/server/models/email-spam-complaint-event.test.js +++ b/ghost/core/test/unit/server/models/email-spam-complaint-event.test.js @@ -1,5 +1,5 @@ const EmailSpamComplaintEvent = require('../../../../core/server/models/email-spam-complaint-event'); -const assert = require('assert'); +const assert = require('assert/strict'); describe('EmailSpamComplaintEvent', function () { describe('destroy', function () { diff --git a/ghost/core/test/unit/server/models/milestone.test.js b/ghost/core/test/unit/server/models/milestone.test.js index a6df26f9d7..376e5e8ab3 100644 --- a/ghost/core/test/unit/server/models/milestone.test.js +++ b/ghost/core/test/unit/server/models/milestone.test.js @@ -1,5 +1,5 @@ const models = require('../../../../core/server/models'); -const assert = require('assert'); +const assert = require('assert/strict'); const errors = require('@tryghost/errors'); describe('Unit: models/milestone', function () { diff --git a/ghost/core/test/unit/server/models/single-use-token.test.js b/ghost/core/test/unit/server/models/single-use-token.test.js index 45de1ce401..3a036bca64 100644 --- a/ghost/core/test/unit/server/models/single-use-token.test.js +++ b/ghost/core/test/unit/server/models/single-use-token.test.js @@ -1,7 +1,7 @@ const models = require('../../../../core/server/models'); const should = require('should'); const sinon = require('sinon'); -const assert = require('assert'); +const assert = require('assert/strict'); let clock; let sandbox; diff --git a/ghost/core/test/unit/server/models/suppression.test.js b/ghost/core/test/unit/server/models/suppression.test.js index 0a6c9f6b0a..c613145237 100644 --- a/ghost/core/test/unit/server/models/suppression.test.js +++ b/ghost/core/test/unit/server/models/suppression.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const Suppression = require('../../../../core/server/models/suppression'); describe('Suppression', function () { diff --git a/ghost/core/test/unit/server/services/api-version-compatibility/legacy-api-path-match.test.js b/ghost/core/test/unit/server/services/api-version-compatibility/legacy-api-path-match.test.js index bd00797f21..a2a13745f3 100644 --- a/ghost/core/test/unit/server/services/api-version-compatibility/legacy-api-path-match.test.js +++ b/ghost/core/test/unit/server/services/api-version-compatibility/legacy-api-path-match.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const legacyApiPathMatch = require('../../../../../core/server/services/api-version-compatibility/legacy-api-path-match'); diff --git a/ghost/core/test/unit/server/services/api-version-compatibility/mw-content-version.test.js b/ghost/core/test/unit/server/services/api-version-compatibility/mw-content-version.test.js index 89e6174644..873f0bee19 100644 --- a/ghost/core/test/unit/server/services/api-version-compatibility/mw-content-version.test.js +++ b/ghost/core/test/unit/server/services/api-version-compatibility/mw-content-version.test.js @@ -1,5 +1,5 @@ const sinon = require('sinon'); -const assert = require('assert'); +const assert = require('assert/strict'); const {contentVersion} = require('../../../../../core/server/services/api-version-compatibility/'); diff --git a/ghost/core/test/unit/server/services/api-version-compatibility/mw-version-rewrites.test.js b/ghost/core/test/unit/server/services/api-version-compatibility/mw-version-rewrites.test.js index f7e2b0f305..942b283c34 100644 --- a/ghost/core/test/unit/server/services/api-version-compatibility/mw-version-rewrites.test.js +++ b/ghost/core/test/unit/server/services/api-version-compatibility/mw-version-rewrites.test.js @@ -1,5 +1,5 @@ const sinon = require('sinon'); -const assert = require('assert'); +const assert = require('assert/strict'); const mwVersionRewrites = require('../../../../../core/server/services/api-version-compatibility/mw-version-rewrites'); const configUtils = require('../../../../utils/configUtils'); diff --git a/ghost/core/test/unit/server/services/collections/CollectionsServiceWrapper.test.js b/ghost/core/test/unit/server/services/collections/CollectionsServiceWrapper.test.js index 582fef94af..a130eb5667 100644 --- a/ghost/core/test/unit/server/services/collections/CollectionsServiceWrapper.test.js +++ b/ghost/core/test/unit/server/services/collections/CollectionsServiceWrapper.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const collectionsServiceWrapper = require('../../../../../core/server/services/collections'); const {CollectionsService} = require('@tryghost/collections'); diff --git a/ghost/core/test/unit/server/services/collections/PostsDataRepositoryBookshelf.test.ts b/ghost/core/test/unit/server/services/collections/PostsDataRepositoryBookshelf.test.ts index beb9404659..13fe5ce69c 100644 --- a/ghost/core/test/unit/server/services/collections/PostsDataRepositoryBookshelf.test.ts +++ b/ghost/core/test/unit/server/services/collections/PostsDataRepositoryBookshelf.test.ts @@ -1,5 +1,5 @@ const sinon = require('sinon'); -const assert = require('assert'); +const assert = require('assert/strict'); const {PostsDataRepositoryBookshelf} = require('../../../../../core/server/services/collections/PostsDataRepositoryBookshelf'); describe('PostsDataRepositoryBookshelf', function () { diff --git a/ghost/core/test/unit/server/services/frontend-data-service/frontend-data-service.test.js b/ghost/core/test/unit/server/services/frontend-data-service/frontend-data-service.test.js index 53c0886822..a1cfa8f702 100644 --- a/ghost/core/test/unit/server/services/frontend-data-service/frontend-data-service.test.js +++ b/ghost/core/test/unit/server/services/frontend-data-service/frontend-data-service.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const models = require('../../../../../core/server/models'); diff --git a/ghost/core/test/unit/server/services/frontend-data-service/index.test.js b/ghost/core/test/unit/server/services/frontend-data-service/index.test.js index 29cb9feb8c..d581260ec0 100644 --- a/ghost/core/test/unit/server/services/frontend-data-service/index.test.js +++ b/ghost/core/test/unit/server/services/frontend-data-service/index.test.js @@ -1,5 +1,5 @@ const models = require('../../../../../core/server/models'); -const assert = require('assert'); +const assert = require('assert/strict'); describe('Frontend Data Service', function () { let frontendDataService; diff --git a/ghost/core/test/unit/server/services/limits.test.js b/ghost/core/test/unit/server/services/limits.test.js index 22a0801991..fbffef2198 100644 --- a/ghost/core/test/unit/server/services/limits.test.js +++ b/ghost/core/test/unit/server/services/limits.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const rewire = require('rewire'); diff --git a/ghost/core/test/unit/server/services/mail/GhostMailer.test.js b/ghost/core/test/unit/server/services/mail/GhostMailer.test.js index 627a217fca..fc4d79e043 100644 --- a/ghost/core/test/unit/server/services/mail/GhostMailer.test.js +++ b/ghost/core/test/unit/server/services/mail/GhostMailer.test.js @@ -6,7 +6,7 @@ const settingsCache = require('../../../../../core/shared/settings-cache'); const configUtils = require('../../../../utils/configUtils'); const urlUtils = require('../../../../../core/shared/url-utils'); let mailer; -const assert = require('assert'); +const assert = require('assert/strict'); // Mock SMTP config const SMTP = { diff --git a/ghost/core/test/unit/server/services/members/config.test.js b/ghost/core/test/unit/server/services/members/config.test.js index 1a82ab8adb..6566664bd5 100644 --- a/ghost/core/test/unit/server/services/members/config.test.js +++ b/ghost/core/test/unit/server/services/members/config.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const MembersConfigProvider = require('../../../../../core/server/services/members/MembersConfigProvider'); diff --git a/ghost/core/test/unit/server/services/mentions/ResourceService.test.js b/ghost/core/test/unit/server/services/mentions/ResourceService.test.js index 9c8ce64f4d..cbebb61262 100644 --- a/ghost/core/test/unit/server/services/mentions/ResourceService.test.js +++ b/ghost/core/test/unit/server/services/mentions/ResourceService.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const ResourceService = require('../../../../../core/server/services/mentions/ResourceService'); const UrlUtils = require('@tryghost/url-utils'); diff --git a/ghost/core/test/unit/server/services/mentions/RoutingService.test.js b/ghost/core/test/unit/server/services/mentions/RoutingService.test.js index bb22c21812..d16429ee72 100644 --- a/ghost/core/test/unit/server/services/mentions/RoutingService.test.js +++ b/ghost/core/test/unit/server/services/mentions/RoutingService.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const nock = require('nock'); const got = require('got'); diff --git a/ghost/core/test/unit/server/services/milestones/BookshelfMilestoneRepository.test.js b/ghost/core/test/unit/server/services/milestones/BookshelfMilestoneRepository.test.js index 01a3b24a40..2c28a63890 100644 --- a/ghost/core/test/unit/server/services/milestones/BookshelfMilestoneRepository.test.js +++ b/ghost/core/test/unit/server/services/milestones/BookshelfMilestoneRepository.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const models = require('../../../../../core/server/models'); const DomainEvents = require('@tryghost/domain-events'); diff --git a/ghost/core/test/unit/server/services/milestones/MilestoneQueries.test.js b/ghost/core/test/unit/server/services/milestones/MilestoneQueries.test.js index d154d23e1d..8737c2cd68 100644 --- a/ghost/core/test/unit/server/services/milestones/MilestoneQueries.test.js +++ b/ghost/core/test/unit/server/services/milestones/MilestoneQueries.test.js @@ -1,5 +1,5 @@ const db = require('../../../../../core/server/data/db'); -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); describe('MilestoneQueries', function () { diff --git a/ghost/core/test/unit/server/services/milestones/index.test.js b/ghost/core/test/unit/server/services/milestones/index.test.js index 66e614a5dd..5cd8b71548 100644 --- a/ghost/core/test/unit/server/services/milestones/index.test.js +++ b/ghost/core/test/unit/server/services/milestones/index.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); describe('Milestones Service', function () { let milestonesService; diff --git a/ghost/core/test/unit/server/services/newsletters/index.test.js b/ghost/core/test/unit/server/services/newsletters/index.test.js index b2f5fa4ff7..b8beb5b488 100644 --- a/ghost/core/test/unit/server/services/newsletters/index.test.js +++ b/ghost/core/test/unit/server/services/newsletters/index.test.js @@ -1,5 +1,5 @@ const models = require('../../../../../core/server/models'); -const assert = require('assert'); +const assert = require('assert/strict'); describe('Newsletters Service', function () { let newslettersService; diff --git a/ghost/core/test/unit/server/services/newsletters/service.test.js b/ghost/core/test/unit/server/services/newsletters/service.test.js index 586591ca3c..a25d2f0a1e 100644 --- a/ghost/core/test/unit/server/services/newsletters/service.test.js +++ b/ghost/core/test/unit/server/services/newsletters/service.test.js @@ -1,5 +1,5 @@ const sinon = require('sinon'); -const assert = require('assert'); +const assert = require('assert/strict'); // DI requirements const models = require('../../../../../core/server/models'); diff --git a/ghost/core/test/unit/server/services/oembed/nft-oembed.test.js b/ghost/core/test/unit/server/services/oembed/nft-oembed.test.js index cb548149e3..ee0a5732e2 100644 --- a/ghost/core/test/unit/server/services/oembed/nft-oembed.test.js +++ b/ghost/core/test/unit/server/services/oembed/nft-oembed.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const NFTOembedProvider = require('../../../../../core/server/services/oembed/NFTOEmbedProvider'); describe('NFTOEmbedProvider', function () { diff --git a/ghost/core/test/unit/server/services/oembed/twitter-embed.test.js b/ghost/core/test/unit/server/services/oembed/twitter-embed.test.js index ff9ecc81ed..6c7edc9b7c 100644 --- a/ghost/core/test/unit/server/services/oembed/twitter-embed.test.js +++ b/ghost/core/test/unit/server/services/oembed/twitter-embed.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const TwitterOEmbedProvider = require('../../../../../core/server/services/oembed/TwitterOEmbedProvider'); const externalRequest = require('../../../../../core/server/lib/request-external'); const nock = require('nock'); diff --git a/ghost/core/test/unit/server/services/segment/DomainEventsAnalytics.test.js b/ghost/core/test/unit/server/services/segment/DomainEventsAnalytics.test.js index e9d0621706..d90e495de8 100644 --- a/ghost/core/test/unit/server/services/segment/DomainEventsAnalytics.test.js +++ b/ghost/core/test/unit/server/services/segment/DomainEventsAnalytics.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const ObjectId = require('bson-objectid').default; diff --git a/ghost/core/test/unit/server/services/segment/ModelEventsAnalytics.test.js b/ghost/core/test/unit/server/services/segment/ModelEventsAnalytics.test.js index 40e7caf57e..53b682a430 100644 --- a/ghost/core/test/unit/server/services/segment/ModelEventsAnalytics.test.js +++ b/ghost/core/test/unit/server/services/segment/ModelEventsAnalytics.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); // To test diff --git a/ghost/core/test/unit/server/services/segment/index.test.js b/ghost/core/test/unit/server/services/segment/index.test.js index c123a7db96..c3dbe474af 100644 --- a/ghost/core/test/unit/server/services/segment/index.test.js +++ b/ghost/core/test/unit/server/services/segment/index.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); describe('Segment Analytics Service', function () { let segmentService; diff --git a/ghost/core/test/unit/server/services/settings/settings-bread-service.test.js b/ghost/core/test/unit/server/services/settings/settings-bread-service.test.js index 007f42afcb..1e95578996 100644 --- a/ghost/core/test/unit/server/services/settings/settings-bread-service.test.js +++ b/ghost/core/test/unit/server/services/settings/settings-bread-service.test.js @@ -1,5 +1,5 @@ const sinon = require('sinon'); -const assert = require('assert'); +const assert = require('assert/strict'); const mail = require('../../../../../core/server/services/mail'); const SettingsBreadService = require('../../../../../core/server/services/settings/SettingsBREADService'); const urlUtils = require('../../../../../core/shared/url-utils.js'); diff --git a/ghost/core/test/unit/server/services/slack-notifications/index.test.js b/ghost/core/test/unit/server/services/slack-notifications/index.test.js index 51a6d2d2c1..1d082d5e2b 100644 --- a/ghost/core/test/unit/server/services/slack-notifications/index.test.js +++ b/ghost/core/test/unit/server/services/slack-notifications/index.test.js @@ -1,5 +1,5 @@ const {configUtils} = require('../../../../utils/e2e-framework'); -const assert = require('assert'); +const assert = require('assert/strict'); const nock = require('nock'); const DomainEvents = require('@tryghost/domain-events'); const {MilestoneCreatedEvent} = require('@tryghost/milestones'); @@ -41,6 +41,6 @@ describe('Slack Notifications Service', function () { // Wait for the dispatched events (because this happens async) await DomainEvents.allSettled(); - assert.strictEqual(scope.isDone(), true); + assert.equal(scope.isDone(), true); }); }); diff --git a/ghost/core/test/unit/server/services/themes/validate.test.js b/ghost/core/test/unit/server/services/themes/validate.test.js index ed85e818b2..2471675e90 100644 --- a/ghost/core/test/unit/server/services/themes/validate.test.js +++ b/ghost/core/test/unit/server/services/themes/validate.test.js @@ -3,7 +3,7 @@ const sinon = require('sinon'); const validate = require('../../../../../core/server/services/themes/validate'); const list = require('../../../../../core/server/services/themes/list'); const gscan = require('gscan'); -const assert = require('assert'); +const assert = require('assert/strict'); const adapterManager = require('../../../../../core/server/services/adapter-manager'); const InMemoryCache = require('../../../../../core/server/adapters/cache/MemoryCache'); const logging = require('@tryghost/logging'); diff --git a/ghost/core/test/unit/server/services/tiers/TierRepository.test.js b/ghost/core/test/unit/server/services/tiers/TierRepository.test.js index 7a835e64b0..1aad4068a0 100644 --- a/ghost/core/test/unit/server/services/tiers/TierRepository.test.js +++ b/ghost/core/test/unit/server/services/tiers/TierRepository.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const {Product: ProductModel} = require('../../../../../core/server/models/product'); const TierRepository = require('../../../../../core/server/services/tiers/TierRepository'); diff --git a/ghost/core/test/unit/server/services/url/Resources.test.js b/ghost/core/test/unit/server/services/url/Resources.test.js index 68bc5ec1c3..3c535a4422 100644 --- a/ghost/core/test/unit/server/services/url/Resources.test.js +++ b/ghost/core/test/unit/server/services/url/Resources.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const Resources = require('../../../../../core/server/services/url/Resources'); diff --git a/ghost/core/test/unit/server/services/users/users-service.test.js b/ghost/core/test/unit/server/services/users/users-service.test.js index 8cf147cf47..fd273b1bf5 100644 --- a/ghost/core/test/unit/server/services/users/users-service.test.js +++ b/ghost/core/test/unit/server/services/users/users-service.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const Users = require('../../../../../core/server/services/Users'); diff --git a/ghost/core/test/unit/server/services/webhooks/serialize.test.js b/ghost/core/test/unit/server/services/webhooks/serialize.test.js index 899b0611e7..e724654e0a 100644 --- a/ghost/core/test/unit/server/services/webhooks/serialize.test.js +++ b/ghost/core/test/unit/server/services/webhooks/serialize.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const models = require('../../../../../core/server/models'); diff --git a/ghost/core/test/unit/server/services/webhooks/trigger.test.js b/ghost/core/test/unit/server/services/webhooks/trigger.test.js index af5a72ce93..19919a5298 100644 --- a/ghost/core/test/unit/server/services/webhooks/trigger.test.js +++ b/ghost/core/test/unit/server/services/webhooks/trigger.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const WebhookTrigger = require('../../../../../core/server/services/webhooks/WebhookTrigger'); diff --git a/ghost/core/test/unit/shared/sentry.test.js b/ghost/core/test/unit/shared/sentry.test.js index 3728abb121..cdd219b3a1 100644 --- a/ghost/core/test/unit/shared/sentry.test.js +++ b/ghost/core/test/unit/shared/sentry.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const configUtils = require('../../utils/configUtils'); diff --git a/ghost/core/test/utils/e2e-framework-mock-manager.js b/ghost/core/test/utils/e2e-framework-mock-manager.js index 313aa9d683..622daf92fe 100644 --- a/ghost/core/test/utils/e2e-framework-mock-manager.js +++ b/ghost/core/test/utils/e2e-framework-mock-manager.js @@ -1,6 +1,6 @@ const errors = require('@tryghost/errors'); const sinon = require('sinon'); -const assert = require('assert'); +const assert = require('assert/strict'); const nock = require('nock'); const MailgunClient = require('@tryghost/mailgun-client'); diff --git a/ghost/domain-events/test/DomainEvents.test.js b/ghost/domain-events/test/DomainEvents.test.js index 3a175559d8..a1adddcd24 100644 --- a/ghost/domain-events/test/DomainEvents.test.js +++ b/ghost/domain-events/test/DomainEvents.test.js @@ -1,5 +1,5 @@ const DomainEvents = require('../'); -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const logging = require('@tryghost/logging'); diff --git a/ghost/dynamic-routing-events/test/dynamic-routing-events.test.js b/ghost/dynamic-routing-events/test/dynamic-routing-events.test.js index 6e9a773f85..0f28273a9b 100644 --- a/ghost/dynamic-routing-events/test/dynamic-routing-events.test.js +++ b/ghost/dynamic-routing-events/test/dynamic-routing-events.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const events = require('../index'); describe('Dynamic Routing Events', function () { diff --git a/ghost/dynamic-routing-events/test/lib/URLResourceUpdatedEvent.test.js b/ghost/dynamic-routing-events/test/lib/URLResourceUpdatedEvent.test.js index 3cab0329ca..80afdc260b 100644 --- a/ghost/dynamic-routing-events/test/lib/URLResourceUpdatedEvent.test.js +++ b/ghost/dynamic-routing-events/test/lib/URLResourceUpdatedEvent.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const {URLResourceUpdatedEvent} = require('../../index'); describe('URLResourceUpdatedEvent', function () { diff --git a/ghost/email-content-generator/test/email-content-generator.test.js b/ghost/email-content-generator/test/email-content-generator.test.js index 6186a2e414..5cb192f4b2 100644 --- a/ghost/email-content-generator/test/email-content-generator.test.js +++ b/ghost/email-content-generator/test/email-content-generator.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const path = require('path'); const EmailContentGenerator = require('../index'); diff --git a/ghost/email-events/test/index.test.js b/ghost/email-events/test/index.test.js index 32110b42ec..9359f44f39 100644 --- a/ghost/email-events/test/index.test.js +++ b/ghost/email-events/test/index.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const events = require('../'); describe('index.js', function () { diff --git a/ghost/email-events/test/lib/EmailBouncedEvent.test.js b/ghost/email-events/test/lib/EmailBouncedEvent.test.js index 98e55c5667..e467363a35 100644 --- a/ghost/email-events/test/lib/EmailBouncedEvent.test.js +++ b/ghost/email-events/test/lib/EmailBouncedEvent.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const ObjectID = require('bson-objectid').default; const EmailBouncedEvent = require('../../lib/EmailBouncedEvent'); diff --git a/ghost/email-events/test/lib/EmailDeliveredEvent.test.js b/ghost/email-events/test/lib/EmailDeliveredEvent.test.js index 8eb887b9a8..ac450c5e0c 100644 --- a/ghost/email-events/test/lib/EmailDeliveredEvent.test.js +++ b/ghost/email-events/test/lib/EmailDeliveredEvent.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const ObjectID = require('bson-objectid').default; const EmailDeliveredEvent = require('../../lib/EmailDeliveredEvent'); diff --git a/ghost/email-events/test/lib/EmailOpenedEvent.test.js b/ghost/email-events/test/lib/EmailOpenedEvent.test.js index b22df59f80..c53d349071 100644 --- a/ghost/email-events/test/lib/EmailOpenedEvent.test.js +++ b/ghost/email-events/test/lib/EmailOpenedEvent.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const ObjectID = require('bson-objectid').default; const EmailOpenedEvent = require('../../lib/EmailOpenedEvent'); diff --git a/ghost/email-events/test/lib/EmailTemporaryBouncedEvent.test.js b/ghost/email-events/test/lib/EmailTemporaryBouncedEvent.test.js index 22bd599b86..41263ee2cf 100644 --- a/ghost/email-events/test/lib/EmailTemporaryBouncedEvent.test.js +++ b/ghost/email-events/test/lib/EmailTemporaryBouncedEvent.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const ObjectID = require('bson-objectid').default; const EmailTemporaryBouncedEvent = require('../../lib/EmailTemporaryBouncedEvent'); diff --git a/ghost/email-events/test/lib/EmailUnsubscribedEvent.test.js b/ghost/email-events/test/lib/EmailUnsubscribedEvent.test.js index e88e896477..7296928eb4 100644 --- a/ghost/email-events/test/lib/EmailUnsubscribedEvent.test.js +++ b/ghost/email-events/test/lib/EmailUnsubscribedEvent.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const ObjectID = require('bson-objectid').default; const EmailUnsubscribedEvent = require('../../lib/EmailUnsubscribedEvent'); diff --git a/ghost/email-events/test/lib/SpamComplaintEvent.test.js b/ghost/email-events/test/lib/SpamComplaintEvent.test.js index c67bead807..95c78c814e 100644 --- a/ghost/email-events/test/lib/SpamComplaintEvent.test.js +++ b/ghost/email-events/test/lib/SpamComplaintEvent.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const ObjectID = require('bson-objectid').default; const SpamComplaintEvent = require('../../lib/SpamComplaintEvent'); diff --git a/ghost/email-service/test/batch-sending-service.test.js b/ghost/email-service/test/batch-sending-service.test.js index e2ca295090..7221ae84af 100644 --- a/ghost/email-service/test/batch-sending-service.test.js +++ b/ghost/email-service/test/batch-sending-service.test.js @@ -1,7 +1,7 @@ const {createModel, createModelClass, createDb, sleep} = require('./utils'); const BatchSendingService = require('../lib/BatchSendingService'); const sinon = require('sinon'); -const assert = require('assert'); +const assert = require('assert/strict'); const logging = require('@tryghost/logging'); const nql = require('@tryghost/nql'); const errors = require('@tryghost/errors'); diff --git a/ghost/email-service/test/email-controller.test.js b/ghost/email-service/test/email-controller.test.js index 08f07b29fc..3538c7fda2 100644 --- a/ghost/email-service/test/email-controller.test.js +++ b/ghost/email-service/test/email-controller.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const EmailController = require('../lib/EmailController'); const {createModel, createModelClass} = require('./utils'); @@ -228,7 +228,7 @@ describe('Email Controller', function () { emails: ['example@example.com'] } }); - assert.strictEqual(result, undefined); + assert.equal(result, undefined); }); }); @@ -271,7 +271,7 @@ describe('Email Controller', function () { id: '123' } }); - assert.strictEqual(result.get('status'), 'failed'); + assert.equal(result.get('status'), 'failed'); }); }); }); diff --git a/ghost/email-service/test/email-event-processor.test.js b/ghost/email-service/test/email-event-processor.test.js index 4794c8d2d1..95fee46f80 100644 --- a/ghost/email-service/test/email-event-processor.test.js +++ b/ghost/email-service/test/email-event-processor.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const EmailEventProcessor = require('../lib/EmailEventProcessor'); const {createDb} = require('./utils'); const sinon = require('sinon'); @@ -58,7 +58,7 @@ describe('Email Event Processor', function () { describe('getRecipient', function () { it('Returns undefined if both providerId and emailId are missing', async function () { const recipient = await eventProcessor.getRecipient({}); - assert.strictEqual(recipient, undefined); + assert.equal(recipient, undefined); }); it('Uses emailId to query recipient', async function () { @@ -82,13 +82,13 @@ describe('Email Event Processor', function () { it('Returns undefined if no email found for provider', async function () { sinon.stub(db, 'first').resolves(null); const recipient = await eventProcessor.getRecipient({providerId: 'provider-id', email: 'example@example.com'}); - assert.strictEqual(recipient, undefined); + assert.equal(recipient, undefined); }); it('Returns undefined if no recipient found for email', async function () { sinon.stub(db, 'first').resolves(null); const recipient = await eventProcessor.getRecipient({emailId: 'email-id', email: 'example@example.com'}); - assert.strictEqual(recipient, undefined); + assert.equal(recipient, undefined); }); }); diff --git a/ghost/email-service/test/email-event-storage.test.js b/ghost/email-service/test/email-event-storage.test.js index a2eb49eb2f..770c06c722 100644 --- a/ghost/email-service/test/email-event-storage.test.js +++ b/ghost/email-service/test/email-event-storage.test.js @@ -1,7 +1,7 @@ const EmailEventStorage = require('../lib/EmailEventStorage'); const {EmailDeliveredEvent, EmailOpenedEvent, EmailBouncedEvent, EmailTemporaryBouncedEvent, EmailUnsubscribedEvent, SpamComplaintEvent} = require('@tryghost/email-events'); const sinon = require('sinon'); -const assert = require('assert'); +const assert = require('assert/strict'); const logging = require('@tryghost/logging'); const {createDb} = require('./utils'); diff --git a/ghost/email-service/test/email-renderer.test.js b/ghost/email-service/test/email-renderer.test.js index ef6ac0e24e..e1e102b585 100644 --- a/ghost/email-service/test/email-renderer.test.js +++ b/ghost/email-service/test/email-renderer.test.js @@ -1,5 +1,5 @@ const {EmailRenderer} = require('../'); -const assert = require('assert'); +const assert = require('assert/strict'); const cheerio = require('cheerio'); const {createModel, createModelClass} = require('./utils'); const linkReplacer = require('@tryghost/link-replacer'); diff --git a/ghost/email-service/test/email-service.test.js b/ghost/email-service/test/email-service.test.js index 9772c02d33..d94982a6b0 100644 --- a/ghost/email-service/test/email-service.test.js +++ b/ghost/email-service/test/email-service.test.js @@ -1,5 +1,5 @@ const EmailService = require('../lib/EmailService'); -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const {createModel, createModelClass} = require('./utils'); @@ -154,12 +154,12 @@ describe('Email Service', function () { const email = await service.createEmail(post); sinon.assert.calledOnce(scheduleEmail); - assert.strictEqual(email.get('feedback_enabled'), true); - assert.strictEqual(email.get('newsletter_id'), post.get('newsletter').id); - assert.strictEqual(email.get('post_id'), post.id); - assert.strictEqual(email.get('status'), 'pending'); - assert.strictEqual(email.get('source'), post.get('mobiledoc')); - assert.strictEqual(email.get('source_type'), 'mobiledoc'); + assert.equal(email.get('feedback_enabled'), true); + assert.equal(email.get('newsletter_id'), post.get('newsletter').id); + assert.equal(email.get('post_id'), post.id); + assert.equal(email.get('status'), 'pending'); + assert.equal(email.get('source'), post.get('mobiledoc')); + assert.equal(email.get('source_type'), 'mobiledoc'); sinon.assert.calledOnce(scheduleRecurringJobs); }); @@ -190,12 +190,12 @@ describe('Email Service', function () { const email = await service.createEmail(post); sinon.assert.calledOnce(scheduleEmail); - assert.strictEqual(email.get('feedback_enabled'), true); - assert.strictEqual(email.get('newsletter_id'), post.get('newsletter').id); - assert.strictEqual(email.get('post_id'), post.id); - assert.strictEqual(email.get('status'), 'pending'); - assert.strictEqual(email.get('source'), post.get('lexical')); - assert.strictEqual(email.get('source_type'), 'lexical'); + assert.equal(email.get('feedback_enabled'), true); + assert.equal(email.get('newsletter_id'), post.get('newsletter').id); + assert.equal(email.get('post_id'), post.id); + assert.equal(email.get('status'), 'pending'); + assert.equal(email.get('source'), post.get('lexical')); + assert.equal(email.get('source_type'), 'lexical'); }); it('Stores the error in the email model if scheduling fails', async function () { @@ -212,8 +212,8 @@ describe('Email Service', function () { const email = await service.createEmail(post); sinon.assert.calledOnce(scheduleEmail); - assert.strictEqual(email.get('error'), 'Test error'); - assert.strictEqual(email.get('status'), 'failed'); + assert.equal(email.get('error'), 'Test error'); + assert.equal(email.get('status'), 'failed'); }); it('Stores a default error in the email model if scheduling fails', async function () { @@ -230,8 +230,8 @@ describe('Email Service', function () { const email = await service.createEmail(post); sinon.assert.calledOnce(scheduleEmail); - assert.strictEqual(email.get('error'), 'Something went wrong while scheduling the email'); - assert.strictEqual(email.get('status'), 'failed'); + assert.equal(email.get('error'), 'Something went wrong while scheduling the email'); + assert.equal(email.get('status'), 'failed'); }); it('Checks limits before scheduling', async function () { @@ -298,11 +298,11 @@ describe('Email Service', function () { }); membersRepository.get.resolves(member); const exampleMember = await service.getExampleMember('example@example.com', 'status:free'); - assert.strictEqual(exampleMember.id, member.id); - assert.strictEqual(exampleMember.name, member.get('name')); - assert.strictEqual(exampleMember.email, member.get('email')); - assert.strictEqual(exampleMember.uuid, member.get('uuid')); - assert.strictEqual(exampleMember.status, 'free'); + assert.equal(exampleMember.id, member.id); + assert.equal(exampleMember.name, member.get('name')); + assert.equal(exampleMember.email, member.get('email')); + assert.equal(exampleMember.uuid, member.get('uuid')); + assert.equal(exampleMember.status, 'free'); assert.deepEqual(exampleMember.subscriptions, []); assert.deepEqual(exampleMember.tiers, []); }); @@ -327,11 +327,11 @@ describe('Email Service', function () { }); membersRepository.get.resolves(member); const exampleMember = await service.getExampleMember('example@example.com', 'status:-free'); - assert.strictEqual(exampleMember.id, member.id); - assert.strictEqual(exampleMember.name, member.get('name')); - assert.strictEqual(exampleMember.email, member.get('email')); - assert.strictEqual(exampleMember.uuid, member.get('uuid')); - assert.strictEqual(exampleMember.status, 'paid'); + assert.equal(exampleMember.id, member.id); + assert.equal(exampleMember.name, member.get('name')); + assert.equal(exampleMember.email, member.get('email')); + assert.equal(exampleMember.uuid, member.get('uuid')); + assert.equal(exampleMember.status, 'paid'); assert.deepEqual(exampleMember.subscriptions, [ { status: 'active', @@ -358,11 +358,11 @@ describe('Email Service', function () { }); membersRepository.get.resolves(member); const exampleMember = await service.getExampleMember('example@example.com', 'status:free'); - assert.strictEqual(exampleMember.id, member.id); - assert.strictEqual(exampleMember.name, member.get('name')); - assert.strictEqual(exampleMember.email, member.get('email')); - assert.strictEqual(exampleMember.uuid, member.get('uuid')); - assert.strictEqual(exampleMember.status, 'free'); + assert.equal(exampleMember.id, member.id); + assert.equal(exampleMember.name, member.get('name')); + assert.equal(exampleMember.email, member.get('email')); + assert.equal(exampleMember.uuid, member.get('uuid')); + assert.equal(exampleMember.status, 'free'); assert.deepEqual(exampleMember.subscriptions, []); assert.deepEqual(exampleMember.tiers, []); }); @@ -370,8 +370,8 @@ describe('Email Service', function () { it('Returns a member without name if member does not exist', async function () { membersRepository.get.resolves(undefined); const exampleMember = await service.getExampleMember('example@example.com'); - assert.strictEqual(exampleMember.name, ''); - assert.strictEqual(exampleMember.email, 'example@example.com'); + assert.equal(exampleMember.name, ''); + assert.equal(exampleMember.email, 'example@example.com'); assert.ok(exampleMember.id); assert.ok(exampleMember.uuid); }); @@ -410,9 +410,9 @@ describe('Email Service', function () { }); const data = await service.previewEmail(post, post.get('newsletter'), null); - assert.strictEqual(data.html, 'Hello Jamie Larson, Jamie Larson'); - assert.strictEqual(data.plaintext, 'Hello Jamie Larson'); - assert.strictEqual(data.subject, 'Subject'); + assert.equal(data.html, 'Hello Jamie Larson, Jamie Larson'); + assert.equal(data.plaintext, 'Hello Jamie Larson'); + assert.equal(data.subject, 'Subject'); }); }); @@ -428,8 +428,8 @@ describe('Email Service', function () { await service.sendTestEmail(post, post.get('newsletter'), null, ['example@example.com']); sinon.assert.calledOnce(sendingService.send); const members = sendingService.send.firstCall.args[0].members; - assert.strictEqual(members.length, 1); - assert.strictEqual(members[0].email, 'example@example.com'); + assert.equal(members.length, 1); + assert.equal(members[0].email, 'example@example.com'); }); }); }); diff --git a/ghost/email-service/test/mailgun-email-provider.test.js b/ghost/email-service/test/mailgun-email-provider.test.js index 0646b9f111..692e7e9853 100644 --- a/ghost/email-service/test/mailgun-email-provider.test.js +++ b/ghost/email-service/test/mailgun-email-provider.test.js @@ -1,7 +1,7 @@ const MailgunEmailProvider = require('../lib/MailgunEmailProvider'); const sinon = require('sinon'); const should = require('should'); -const assert = require('assert'); +const assert = require('assert/strict'); describe('Mailgun Email Provider', function () { describe('send', function () { @@ -227,7 +227,7 @@ describe('Mailgun Email Provider', function () { describe('getMaximumRecipients', function () { it('returns 1000', function () { const provider = new MailgunEmailProvider({}); - assert.strictEqual(provider.getMaximumRecipients(), 1000); + assert.equal(provider.getMaximumRecipients(), 1000); }); }); }); diff --git a/ghost/email-service/test/sending-service.test.js b/ghost/email-service/test/sending-service.test.js index e7ea126ec8..4da317a525 100644 --- a/ghost/email-service/test/sending-service.test.js +++ b/ghost/email-service/test/sending-service.test.js @@ -1,6 +1,6 @@ const SendingService = require('../lib/SendingService'); const sinon = require('sinon'); -const assert = require('assert'); +const assert = require('assert/strict'); const EmailBodyCache = require('../lib/EmailBodyCache'); describe('Sending service', function () { diff --git a/ghost/email-suppression-list/lib/email-suppression-list.js b/ghost/email-suppression-list/lib/email-suppression-list.js index 44283f4da8..537dd98517 100644 --- a/ghost/email-suppression-list/lib/email-suppression-list.js +++ b/ghost/email-suppression-list/lib/email-suppression-list.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); /** * @typedef {object} EmailSuppressionInfo diff --git a/ghost/email-suppression-list/test/index.test.js b/ghost/email-suppression-list/test/index.test.js index 821796080c..cc3358f7d6 100644 --- a/ghost/email-suppression-list/test/index.test.js +++ b/ghost/email-suppression-list/test/index.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); describe('exports', function () { it('exports the lib/email-suppression-list file', function () { assert(require('../') === require('../lib/email-suppression-list')); diff --git a/ghost/email-suppression-list/test/lib/email-suppression-list.test.js b/ghost/email-suppression-list/test/lib/email-suppression-list.test.js index 4604ff9ffa..7a2c87aa6c 100644 --- a/ghost/email-suppression-list/test/lib/email-suppression-list.test.js +++ b/ghost/email-suppression-list/test/lib/email-suppression-list.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const {EmailSuppressionData, EmailSuppressedEvent} = require('../../lib/email-suppression-list'); describe('EmailSuppressionData', function () { diff --git a/ghost/event-aware-cache-wrapper/test/EventAwareCacheWrapper.test.js b/ghost/event-aware-cache-wrapper/test/EventAwareCacheWrapper.test.js index 19f7ec9590..d31265239c 100644 --- a/ghost/event-aware-cache-wrapper/test/EventAwareCacheWrapper.test.js +++ b/ghost/event-aware-cache-wrapper/test/EventAwareCacheWrapper.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const InMemoryCache = require('@tryghost/adapter-cache-memory-ttl'); const EventAwareCacheWrapper = require('../index'); diff --git a/ghost/external-media-inliner/test/ExternalMediaInliner.test.js b/ghost/external-media-inliner/test/ExternalMediaInliner.test.js index 0be4a41119..5bf3507f86 100644 --- a/ghost/external-media-inliner/test/ExternalMediaInliner.test.js +++ b/ghost/external-media-inliner/test/ExternalMediaInliner.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const nock = require('nock'); const path = require('path'); diff --git a/ghost/extract-api-key/test/extract-api-key.test.js b/ghost/extract-api-key/test/extract-api-key.test.js index 25d6371341..25bba26c41 100644 --- a/ghost/extract-api-key/test/extract-api-key.test.js +++ b/ghost/extract-api-key/test/extract-api-key.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const extractApiKey = require('../index'); describe('Extract API Key', function () { diff --git a/ghost/html-to-plaintext/test/html-to-plaintext.test.js b/ghost/html-to-plaintext/test/html-to-plaintext.test.js index fed8ea167b..065366c82e 100644 --- a/ghost/html-to-plaintext/test/html-to-plaintext.test.js +++ b/ghost/html-to-plaintext/test/html-to-plaintext.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const htmlToPlaintext = require('../'); describe('Html to Plaintext', function () { diff --git a/ghost/i18n/test/i18n.test.js b/ghost/i18n/test/i18n.test.js index 512913ac52..9e3cc09945 100644 --- a/ghost/i18n/test/i18n.test.js +++ b/ghost/i18n/test/i18n.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const i18n = require('../'); diff --git a/ghost/importer-handler-content-files/test/ImporterContentFileHandler.test.js b/ghost/importer-handler-content-files/test/ImporterContentFileHandler.test.js index 98373698e3..2f25f04ff6 100644 --- a/ghost/importer-handler-content-files/test/ImporterContentFileHandler.test.js +++ b/ghost/importer-handler-content-files/test/ImporterContentFileHandler.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const ImporterContentFileHandler = require('../index'); describe('ImporterContentFileHandler', function () { diff --git a/ghost/importer-revue/test/importer-revue.test.js b/ghost/importer-revue/test/importer-revue.test.js index fe3be2c72a..a16f73705a 100644 --- a/ghost/importer-revue/test/importer-revue.test.js +++ b/ghost/importer-revue/test/importer-revue.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const RevueImporter = require('../index'); diff --git a/ghost/job-manager/test/job-manager.test.js b/ghost/job-manager/test/job-manager.test.js index bee32c7a5f..b8add5cc2b 100644 --- a/ghost/job-manager/test/job-manager.test.js +++ b/ghost/job-manager/test/job-manager.test.js @@ -1,7 +1,7 @@ // Switch these lines once there are useful utils // const testUtils = require('./utils'); require('./utils'); -const assert = require('assert'); +const assert = require('assert/strict'); const path = require('path'); const sinon = require('sinon'); const delay = require('delay'); diff --git a/ghost/link-redirects/test/LinkRedirectsService.test.js b/ghost/link-redirects/test/LinkRedirectsService.test.js index ecb0aacfe7..fdeb1e35c2 100644 --- a/ghost/link-redirects/test/LinkRedirectsService.test.js +++ b/ghost/link-redirects/test/LinkRedirectsService.test.js @@ -1,5 +1,5 @@ const {LinkRedirectsService} = require('../index'); -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const crypto = require('crypto'); @@ -25,14 +25,14 @@ describe('LinkRedirectsService', function () { // stub crypto.randomBytes to return a known value toString sinon.stub(crypto, 'randomBytes').returns(Buffer.from('00000000', 'hex')); const url = await instance.getSlugUrl(); - assert.equal(url, 'https://localhost:2368/r/00000000'); + assert.equal(url.href, 'https://localhost:2368/r/00000000'); }); it('works when first random slug already exists', async function () { const instance = new LinkRedirectsService({ linkRedirectRepository: { getByURL: (url) => { - if (url.toString() === 'https://localhost:2368/r/00000000') { + if (url.href === 'https://localhost:2368/r/00000000') { return Promise.resolve({}); } return Promise.resolve(undefined); @@ -47,7 +47,7 @@ describe('LinkRedirectsService', function () { .onFirstCall().returns(Buffer.from('00000000', 'hex')) .onSecondCall().returns(Buffer.from('11111111', 'hex')); const url = await instance.getSlugUrl(); - assert.equal(url, 'https://localhost:2368/r/11111111'); + assert.equal(url.href, 'https://localhost:2368/r/11111111'); }); }); @@ -64,8 +64,8 @@ describe('LinkRedirectsService', function () { }); await instance.addRedirect(new URL('https://localhost:2368/a'), new URL('https://localhost:2368/b')); assert.equal(linkRedirectRepository.save.callCount, 1); - assert.equal(linkRedirectRepository.save.getCall(0).args[0].from.toString(), 'https://localhost:2368/a'); - assert.equal(linkRedirectRepository.save.getCall(0).args[0].to.toString(), 'https://localhost:2368/b'); + assert.equal(linkRedirectRepository.save.getCall(0).args[0].from.href, 'https://localhost:2368/a'); + assert.equal(linkRedirectRepository.save.getCall(0).args[0].to.href, 'https://localhost:2368/b'); }); }); @@ -73,7 +73,7 @@ describe('LinkRedirectsService', function () { it('redirects if found', async function () { const linkRedirectRepository = { getByURL: (url) => { - if (url.toString() === 'https://localhost:2368/r/a') { + if (url.href === 'https://localhost:2368/r/a') { return Promise.resolve({ to: new URL('https://localhost:2368/b') }); diff --git a/ghost/link-replacer/test/LinkReplacer.test.js b/ghost/link-replacer/test/LinkReplacer.test.js index 2d55341efd..737fb18588 100644 --- a/ghost/link-replacer/test/LinkReplacer.test.js +++ b/ghost/link-replacer/test/LinkReplacer.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const linkReplacer = require('../lib/link-replacer'); const cheerio = require('cheerio'); const sinon = require('sinon'); diff --git a/ghost/link-tracking/test/LinkClickTrackingService.test.js b/ghost/link-tracking/test/LinkClickTrackingService.test.js index 32e1ab5940..7cfd4f55c2 100644 --- a/ghost/link-tracking/test/LinkClickTrackingService.test.js +++ b/ghost/link-tracking/test/LinkClickTrackingService.test.js @@ -1,7 +1,7 @@ const LinkClickTrackingService = require('../lib/LinkClickTrackingService'); const sinon = require('sinon'); const should = require('should'); -const assert = require('assert'); +const assert = require('assert/strict'); const ObjectID = require('bson-objectid').default; const PostLink = require('../lib/PostLink'); const {RedirectEvent} = require('@tryghost/link-redirects'); @@ -40,7 +40,7 @@ describe('LinkClickTrackingService', function () { assert.ok(getAll.calledOnceWithExactly({filter: 'post_id:1'})); // Check returned value - assert.deepStrictEqual(links, ['test']); + assert.deepEqual(links, ['test']); }); }); diff --git a/ghost/magic-link/test/index.test.js b/ghost/magic-link/test/index.test.js index 6b234f4742..22520d2671 100644 --- a/ghost/magic-link/test/index.test.js +++ b/ghost/magic-link/test/index.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const MagicLink = require('../'); const crypto = require('crypto'); diff --git a/ghost/mailgun-client/test/mailgun-client.test.js b/ghost/mailgun-client/test/mailgun-client.test.js index f852aee5bd..387fe6c9cc 100644 --- a/ghost/mailgun-client/test/mailgun-client.test.js +++ b/ghost/mailgun-client/test/mailgun-client.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const nock = require('nock'); const sinon = require('sinon'); @@ -150,7 +150,7 @@ describe('MailgunClient', function () { const mailgunClient = new MailgunClient({config, settings}); const response = await mailgunClient.send({}, {}, []); - assert.strictEqual(response, null); + assert.equal(response, null); }); }); @@ -406,7 +406,7 @@ describe('MailgunClient', function () { const mailgunClient = new MailgunClient({config, settings}); const result = mailgunClient.normalizeEvent(event); - assert.deepStrictEqual(result, { + assert.deepEqual(result, { type: 'testEvent', severity: 'testSeverity', recipientEmail: 'testRecipient', @@ -468,7 +468,7 @@ describe('MailgunClient', function () { const mailgunClient = new MailgunClient({config, settings}); const result = mailgunClient.normalizeEvent(event); - assert.deepStrictEqual(result, { + assert.deepEqual(result, { type: 'failed', severity: 'permanent', recipientEmail: 'testRecipient', @@ -540,7 +540,7 @@ describe('MailgunClient', function () { const mailgunClient = new MailgunClient({config, settings}); const result = mailgunClient.normalizeEvent(event); - assert.deepStrictEqual(result, { + assert.deepEqual(result, { type: 'failed', severity: 'permanent', recipientEmail: 'testRecipient', diff --git a/ghost/member-attribution/test/outbound-link-tagger.test.js b/ghost/member-attribution/test/outbound-link-tagger.test.js index 17cb00886e..e1595ddb0b 100644 --- a/ghost/member-attribution/test/outbound-link-tagger.test.js +++ b/ghost/member-attribution/test/outbound-link-tagger.test.js @@ -2,7 +2,7 @@ // const testUtils = require('./utils'); require('./utils'); const {OutboundLinkTagger} = require('../'); -const assert = require('assert'); +const assert = require('assert/strict'); describe('OutboundLinkTagger', function () { describe('Constructor', function () { diff --git a/ghost/members-api/test/unit/lib/repositories/member.test.js b/ghost/members-api/test/unit/lib/repositories/member.test.js index 012889837b..b5691be5a2 100644 --- a/ghost/members-api/test/unit/lib/repositories/member.test.js +++ b/ghost/members-api/test/unit/lib/repositories/member.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const DomainEvents = require('@tryghost/domain-events'); const MemberRepository = require('../../../../lib/repositories/MemberRepository'); diff --git a/ghost/members-api/test/unit/lib/repositories/product.test.js b/ghost/members-api/test/unit/lib/repositories/product.test.js index ef2b27e601..df5b6e9526 100644 --- a/ghost/members-api/test/unit/lib/repositories/product.test.js +++ b/ghost/members-api/test/unit/lib/repositories/product.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const ProductRepository = require('../../../../lib/repositories/ProductRepository'); diff --git a/ghost/members-api/test/unit/lib/services/token.test.js b/ghost/members-api/test/unit/lib/services/token.test.js index 3219fa7b64..56b5a75796 100644 --- a/ghost/members-api/test/unit/lib/services/token.test.js +++ b/ghost/members-api/test/unit/lib/services/token.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const jwt = require('jsonwebtoken'); const jwkToPem = require('jwk-to-pem'); const TokenService = require('../../../../lib/services/TokenService'); diff --git a/ghost/members-csv/test/parse.test.js b/ghost/members-csv/test/parse.test.js index f3daf507b3..e725e8808e 100644 --- a/ghost/members-csv/test/parse.test.js +++ b/ghost/members-csv/test/parse.test.js @@ -1,5 +1,5 @@ const path = require('path'); -const assert = require('assert'); +const assert = require('assert/strict'); const {parse} = require('../index'); const csvPath = path.join(__dirname, '/fixtures/'); diff --git a/ghost/members-csv/test/unparse.test.js b/ghost/members-csv/test/unparse.test.js index ea0e789745..47a48ccaf1 100644 --- a/ghost/members-csv/test/unparse.test.js +++ b/ghost/members-csv/test/unparse.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const {unparse} = require('../index'); describe('unparse', function () { diff --git a/ghost/members-events-service/test/last-seen-at-updater.test.js b/ghost/members-events-service/test/last-seen-at-updater.test.js index 7713f84691..49320ca667 100644 --- a/ghost/members-events-service/test/last-seen-at-updater.test.js +++ b/ghost/members-events-service/test/last-seen-at-updater.test.js @@ -2,7 +2,7 @@ // const testUtils = require('./utils'); require('./utils'); -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const {LastSeenAtUpdater} = require('../'); const DomainEvents = require('@tryghost/domain-events'); diff --git a/ghost/members-importer/test/importer.test.js b/ghost/members-importer/test/importer.test.js index 71ee0a4dca..01bb45cf6e 100644 --- a/ghost/members-importer/test/importer.test.js +++ b/ghost/members-importer/test/importer.test.js @@ -4,7 +4,7 @@ require('./utils'); const Tier = require('@tryghost/tiers/lib/Tier'); const ObjectID = require('bson-objectid').default; -const assert = require('assert'); +const assert = require('assert/strict'); const fs = require('fs-extra'); const path = require('path'); const sinon = require('sinon'); @@ -329,7 +329,7 @@ describe('Importer', function () { const importer = buildMockImporterInstance(); const result = await importer.perform(`${csvPath}/special-cases.csv`); - + // CASE: Member has created_at in the future // The member will not appear in the members list in admin // In this case, we should overwrite create_at to current timestamp diff --git a/ghost/milestones/test/InMemoryMilestoneRepository.test.js b/ghost/milestones/test/InMemoryMilestoneRepository.test.js index 3092bbdd43..3b596eda9d 100644 --- a/ghost/milestones/test/InMemoryMilestoneRepository.test.js +++ b/ghost/milestones/test/InMemoryMilestoneRepository.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const ObjectID = require('bson-objectid'); const InMemoryMilestoneRepository = require('../lib/InMemoryMilestoneRepository'); const Milestone = require('../lib/Milestone'); diff --git a/ghost/milestones/test/Milestone.test.js b/ghost/milestones/test/Milestone.test.js index 8090a797e7..eeeb332382 100644 --- a/ghost/milestones/test/Milestone.test.js +++ b/ghost/milestones/test/Milestone.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const ObjectID = require('bson-objectid'); const Milestone = require('../lib/Milestone'); diff --git a/ghost/milestones/test/MilestonesService.test.js b/ghost/milestones/test/MilestonesService.test.js index 136fcc5349..eed14cad49 100644 --- a/ghost/milestones/test/MilestonesService.test.js +++ b/ghost/milestones/test/MilestonesService.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const { MilestonesService, InMemoryMilestoneRepository diff --git a/ghost/mw-api-version-mismatch/test/mw-api-version-mismatch.test.js b/ghost/mw-api-version-mismatch/test/mw-api-version-mismatch.test.js index 082cbfc81b..4c43c67423 100644 --- a/ghost/mw-api-version-mismatch/test/mw-api-version-mismatch.test.js +++ b/ghost/mw-api-version-mismatch/test/mw-api-version-mismatch.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const errors = require('@tryghost/errors'); diff --git a/ghost/mw-error-handler/test/mw-error-handler.test.js b/ghost/mw-error-handler/test/mw-error-handler.test.js index a5a4792e0c..63bbfb33fa 100644 --- a/ghost/mw-error-handler/test/mw-error-handler.test.js +++ b/ghost/mw-error-handler/test/mw-error-handler.test.js @@ -3,7 +3,7 @@ require('./utils'); const path = require('path'); const should = require('should'); -const assert = require('assert'); +const assert = require('assert/strict'); const {InternalServerError, NotFoundError} = require('@tryghost/errors'); const {cacheControlValues} = require('@tryghost/http-cache-utils'); const { diff --git a/ghost/mw-vhost/test/vhost.test.js b/ghost/mw-vhost/test/vhost.test.js index a323ba1633..f6ee531b6d 100644 --- a/ghost/mw-vhost/test/vhost.test.js +++ b/ghost/mw-vhost/test/vhost.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const http = require('http'); const request = require('supertest'); const vhost = require('..'); diff --git a/ghost/oembed-service/test/hello.test.js b/ghost/oembed-service/test/hello.test.js index 76dd5f6ef7..d9b9927028 100644 --- a/ghost/oembed-service/test/hello.test.js +++ b/ghost/oembed-service/test/hello.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); describe('Hello world', function () { it('Runs a test', function () { diff --git a/ghost/payments/test/lib/payments.test.js b/ghost/payments/test/lib/payments.test.js index f744c30ff3..fbf8c4ed99 100644 --- a/ghost/payments/test/lib/payments.test.js +++ b/ghost/payments/test/lib/payments.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const knex = require('knex'); const {Tier} = require('@tryghost/tiers'); @@ -294,8 +294,8 @@ describe('PaymentsService', function () { }); // assert trialDays should not be set when coupon is present for checkout session - assert.strictEqual(stripeAPIService.createCheckoutSession.getCall(0).args[2].coupon, 'stripe_coupon_1'); - assert.strictEqual(stripeAPIService.createCheckoutSession.getCall(0).args[2].trialDays, undefined); + assert.equal(stripeAPIService.createCheckoutSession.getCall(0).args[2].coupon, 'stripe_coupon_1'); + assert.equal(stripeAPIService.createCheckoutSession.getCall(0).args[2].trialDays, undefined); }); }); }); diff --git a/ghost/posts-service/test/PostsExporter.test.js b/ghost/posts-service/test/PostsExporter.test.js index dff9955385..53433bdaa3 100644 --- a/ghost/posts-service/test/PostsExporter.test.js +++ b/ghost/posts-service/test/PostsExporter.test.js @@ -1,5 +1,5 @@ const {PostsExporter} = require('../index'); -const assert = require('assert'); +const assert = require('assert/strict'); const {createModelClass, createModel} = require('./utils'); class SettingsCache { @@ -179,19 +179,20 @@ describe('PostsExporter', function () { post.status = 'draft'; const posts = await exporter.export({}); + // @TODO: why are these all nulls and not undefined? // No feedback columns - assert.equal(posts[0].feedback_more_like_this, undefined); - assert.equal(posts[0].feedback_less_like_this, undefined); + assert.equal(posts[0].feedback_more_like_this, null); + assert.equal(posts[0].feedback_less_like_this, null); // Sends etc - assert.equal(posts[0].sends, undefined); - assert.equal(posts[0].opens, undefined); - assert.equal(posts[0].clicks, undefined); - assert.equal(posts[0].newsletter_name, undefined); + assert.equal(posts[0].sends, null); + assert.equal(posts[0].opens, null); + assert.equal(posts[0].clicks, null); + assert.equal(posts[0].newsletter_name, null); // Signups - assert.equal(posts[0].free_signups, undefined); - assert.equal(posts[0].paid_conversions, undefined); + assert.equal(posts[0].free_signups, null); + assert.equal(posts[0].paid_conversions, null); }); it('Hides member related columns if members disabled', async function () { diff --git a/ghost/posts-service/test/PostsService.test.js b/ghost/posts-service/test/PostsService.test.js index 6a65ae943c..af7a8812c0 100644 --- a/ghost/posts-service/test/PostsService.test.js +++ b/ghost/posts-service/test/PostsService.test.js @@ -1,5 +1,5 @@ const {PostsService} = require('../index'); -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); describe('Posts Service', function () { diff --git a/ghost/slack-notifications/test/SlackNotifications.test.js b/ghost/slack-notifications/test/SlackNotifications.test.js index 23ba27ac02..2bb9d163cc 100644 --- a/ghost/slack-notifications/test/SlackNotifications.test.js +++ b/ghost/slack-notifications/test/SlackNotifications.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const SlackNotifications = require('../lib/SlackNotifications'); const nock = require('nock'); diff --git a/ghost/slack-notifications/test/SlackNotificationsService.test.js b/ghost/slack-notifications/test/SlackNotificationsService.test.js index 592b593763..1e90150da4 100644 --- a/ghost/slack-notifications/test/SlackNotificationsService.test.js +++ b/ghost/slack-notifications/test/SlackNotificationsService.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const {SlackNotificationsService} = require('../index'); const ObjectId = require('bson-objectid').default; diff --git a/ghost/stats-service/test/lib/members.test.js b/ghost/stats-service/test/lib/members.test.js index 01fe615882..1d79851e7f 100644 --- a/ghost/stats-service/test/lib/members.test.js +++ b/ghost/stats-service/test/lib/members.test.js @@ -1,6 +1,6 @@ const MembersStatsService = require('../../lib/MembersStatsService'); const knex = require('knex').default; -const assert = require('assert'); +const assert = require('assert/strict'); const moment = require('moment'); const sinon = require('sinon'); diff --git a/ghost/stats-service/test/lib/referrers.test.js b/ghost/stats-service/test/lib/referrers.test.js index bf77366084..25d26b228c 100644 --- a/ghost/stats-service/test/lib/referrers.test.js +++ b/ghost/stats-service/test/lib/referrers.test.js @@ -1,5 +1,5 @@ const knex = require('knex').default; -const assert = require('assert'); +const assert = require('assert/strict'); const ReferrersStatsService = require('../../lib/ReferrersStatsService'); describe('ReferrersStatsService', function () { @@ -106,7 +106,7 @@ describe('ReferrersStatsService', function () { }; // Is sorted by date - assert.deepStrictEqual(results.data.map(result => result.date), ['1970-01-01', '1970-01-02', '1970-01-03', '1970-01-04', '1970-01-05', '1970-01-06', '1970-01-07', '1970-01-08', '1970-01-09', '1970-01-09']); + assert.deepEqual(results.data.map(result => result.date), ['1970-01-01', '1970-01-02', '1970-01-03', '1970-01-04', '1970-01-05', '1970-01-06', '1970-01-07', '1970-01-08', '1970-01-09', '1970-01-09']); const firstDayCounts = results.data.find(finder('Twitter', '1970-01-01')); const secondDayCounts = results.data.find(finder('Ghost Newsletter', '1970-01-02')); diff --git a/ghost/stats-service/test/lib/stats.test.js b/ghost/stats-service/test/lib/stats.test.js index ef1b31b48d..603e5e6842 100644 --- a/ghost/stats-service/test/lib/stats.test.js +++ b/ghost/stats-service/test/lib/stats.test.js @@ -1,6 +1,6 @@ const StatsService = require('../../lib/StatsService'); const knex = require('knex').default; -const assert = require('assert'); +const assert = require('assert/strict'); describe('StatsService', function () { it('Exposes a create factory', function () { diff --git a/ghost/stats-service/test/lib/subscriptions.test.js b/ghost/stats-service/test/lib/subscriptions.test.js index f8a94ef3e4..9e93b72396 100644 --- a/ghost/stats-service/test/lib/subscriptions.test.js +++ b/ghost/stats-service/test/lib/subscriptions.test.js @@ -1,5 +1,5 @@ const knex = require('knex').default; -const assert = require('assert'); +const assert = require('assert/strict'); const SubscriptionStatsService = require('../../lib/SubscriptionStatsService'); describe('SubscriptionStatsService', function () { diff --git a/ghost/stripe/test/unit/lib/Migrations.test.js b/ghost/stripe/test/unit/lib/Migrations.test.js index 290e2a731d..f50e24643e 100644 --- a/ghost/stripe/test/unit/lib/Migrations.test.js +++ b/ghost/stripe/test/unit/lib/Migrations.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const Migrations = require('../../../lib/StripeMigrations'); diff --git a/ghost/tiers/test/Tier.test.js b/ghost/tiers/test/Tier.test.js index 6528ddf42c..5a7a47ded2 100644 --- a/ghost/tiers/test/Tier.test.js +++ b/ghost/tiers/test/Tier.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const ObjectID = require('bson-objectid'); const Tier = require('../lib/Tier'); const TierActivatedEvent = require('../lib/TierActivatedEvent'); @@ -266,7 +266,7 @@ describe('Tier', function () { tier.description = 'Updated description'; - assert.strictEqual('Updated description', tier.description); + assert.equal('Updated description', tier.description); }); }); }); diff --git a/ghost/tiers/test/TiersAPI.test.js b/ghost/tiers/test/TiersAPI.test.js index 890244e555..4dab87d5db 100644 --- a/ghost/tiers/test/TiersAPI.test.js +++ b/ghost/tiers/test/TiersAPI.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const TiersAPI = require('../lib/TiersAPI'); const InMemoryTierRepository = require('../lib/InMemoryTierRepository'); diff --git a/ghost/tiers/test/index.test.js b/ghost/tiers/test/index.test.js index 5db3270ddf..7a5b0c169d 100644 --- a/ghost/tiers/test/index.test.js +++ b/ghost/tiers/test/index.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const { Tier, TiersAPI, diff --git a/ghost/update-check-service/test/update-check-service.test.js b/ghost/update-check-service/test/update-check-service.test.js index b92bba31b5..768bddd05c 100644 --- a/ghost/update-check-service/test/update-check-service.test.js +++ b/ghost/update-check-service/test/update-check-service.test.js @@ -3,7 +3,7 @@ require('./utils'); const sinon = require('sinon'); const moment = require('moment'); const uuid = require('uuid'); -const assert = require('assert'); +const assert = require('assert/strict'); const logging = require('@tryghost/logging'); const UpdateCheckService = require('../lib/UpdateCheckService'); diff --git a/ghost/verification-trigger/test/verification-trigger.test.js b/ghost/verification-trigger/test/verification-trigger.test.js index 73bf58e7c3..b4fe383c64 100644 --- a/ghost/verification-trigger/test/verification-trigger.test.js +++ b/ghost/verification-trigger/test/verification-trigger.test.js @@ -1,7 +1,7 @@ // Switch these lines once there are useful utils // const testUtils = require('./utils'); const sinon = require('sinon'); -const assert = require('assert'); +const assert = require('assert/strict'); require('./utils'); const VerificationTrigger = require('../index'); const DomainEvents = require('@tryghost/domain-events'); diff --git a/ghost/version-notifications-data-service/test/version-notificatons-data-service.test.js b/ghost/version-notifications-data-service/test/version-notificatons-data-service.test.js index 91a361c4aa..13cbdf1edb 100644 --- a/ghost/version-notifications-data-service/test/version-notificatons-data-service.test.js +++ b/ghost/version-notifications-data-service/test/version-notificatons-data-service.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const sinon = require('sinon'); const VersionNotificationsDataService = require('..'); diff --git a/ghost/webmentions/test/InMemoryMentionRepository.test.js b/ghost/webmentions/test/InMemoryMentionRepository.test.js index f87476cad5..59610680c0 100644 --- a/ghost/webmentions/test/InMemoryMentionRepository.test.js +++ b/ghost/webmentions/test/InMemoryMentionRepository.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const ObjectID = require('bson-objectid'); const InMemoryMentionRepository = require('../lib/InMemoryMentionRepository'); const Mention = require('../lib/Mention'); diff --git a/ghost/webmentions/test/Mention.test.js b/ghost/webmentions/test/Mention.test.js index d4981abebe..cc112aa9a9 100644 --- a/ghost/webmentions/test/Mention.test.js +++ b/ghost/webmentions/test/Mention.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const ObjectID = require('bson-objectid'); const Mention = require('../lib/Mention'); diff --git a/ghost/webmentions/test/MentionDiscoveryService.test.js b/ghost/webmentions/test/MentionDiscoveryService.test.js index 17c336326f..447e5248b9 100644 --- a/ghost/webmentions/test/MentionDiscoveryService.test.js +++ b/ghost/webmentions/test/MentionDiscoveryService.test.js @@ -3,7 +3,7 @@ const sinon = require('sinon'); // non-standard to use externalRequest here, but this is required for the overrides in the library, which we want to test for security reasons in combination with the package const externalRequest = require('../../core/core/server/lib/request-external.js'); const dnsPromises = require('dns').promises; -const assert = require('assert'); +const assert = require('assert/strict'); const nock = require('nock'); describe('MentionDiscoveryService', function () { @@ -71,7 +71,7 @@ describe('MentionDiscoveryService', function () { const endpoint = await service.getEndpoint(url); assert(endpoint instanceof URL); - assert.equal(endpoint, 'http://webmentions.endpoint.io/'); + assert.equal(endpoint.href, 'http://webmentions.endpoint.io/'); }); it('Returns null with Links in the header that are not for webmentions', async function () { @@ -92,7 +92,7 @@ describe('MentionDiscoveryService', function () { const endpoint = await service.getEndpoint(url); assert(endpoint instanceof URL); - assert.equal(endpoint, 'http://webmentions.endpoint.io/'); + assert.equal(endpoint.href, 'http://webmentions.endpoint.io/'); }); }); @@ -105,7 +105,7 @@ describe('MentionDiscoveryService', function () { const endpoint = await service.getEndpoint(url); assert(endpoint instanceof URL); - assert.equal(endpoint, 'http://webmentions.endpoint.io/'); + assert.equal(endpoint.href, 'http://webmentions.endpoint.io/'); }); it('Returns endpoint for valid html site with tag in body', async function () { @@ -116,7 +116,7 @@ describe('MentionDiscoveryService', function () { const endpoint = await service.getEndpoint(url); assert(endpoint instanceof URL); - assert.equal(endpoint, 'http://valid.site.org/'); + assert.equal(endpoint.href, 'http://valid.site.org/'); }); it('Returns first endpoint for valid html site with multiple tags in body', async function () { diff --git a/ghost/webmentions/test/MentionSendingService.test.js b/ghost/webmentions/test/MentionSendingService.test.js index 137fec382a..d6735f5094 100644 --- a/ghost/webmentions/test/MentionSendingService.test.js +++ b/ghost/webmentions/test/MentionSendingService.test.js @@ -1,5 +1,5 @@ const {MentionSendingService} = require('../'); -const assert = require('assert'); +const assert = require('assert/strict'); const nock = require('nock'); // non-standard to use externalRequest here, but this is required for the overrides in the libary, which we want to test for security reasons in combination with the package const externalRequest = require('../../core/core/server/lib/request-external.js'); @@ -145,9 +145,9 @@ describe('MentionSendingService', function () { })); sinon.assert.calledOnce(stub); const firstCall = stub.getCall(0).args[0]; - assert.strictEqual(firstCall.url.toString(), 'https://site.com/post/'); - assert.strictEqual(firstCall.html, 'same'); - assert.strictEqual(firstCall.previousHtml, null); + assert.equal(firstCall.url.toString(), 'https://site.com/post/'); + assert.equal(firstCall.html, 'same'); + assert.equal(firstCall.previousHtml, null); }); it('Sends on html change', async function () { @@ -167,9 +167,9 @@ describe('MentionSendingService', function () { })); sinon.assert.calledOnce(stub); const firstCall = stub.getCall(0).args[0]; - assert.strictEqual(firstCall.url.toString(), 'https://site.com/post/'); - assert.strictEqual(firstCall.html, 'updated'); - assert.strictEqual(firstCall.previousHtml, 'same'); + assert.equal(firstCall.url.toString(), 'https://site.com/post/'); + assert.equal(firstCall.html, 'updated'); + assert.equal(firstCall.previousHtml, 'same'); }); it('Catches and logs errors', async function () { @@ -238,7 +238,7 @@ describe('MentionSendingService', function () { `}); - assert.strictEqual(scope.isDone(), true); + assert.equal(scope.isDone(), true); assert.equal(counter, 3); }); @@ -274,7 +274,7 @@ describe('MentionSendingService', function () { `}); - assert.strictEqual(scope.isDone(), true); + assert.equal(scope.isDone(), true); assert.equal(counter, 3); assert(errorLogStub.calledOnce); }); @@ -301,7 +301,7 @@ describe('MentionSendingService', function () { await service.sendAll({url: new URL('https://site.com'), html: `Example`, previousHtml: `Example`}); - assert.strictEqual(scope.isDone(), true); + assert.equal(scope.isDone(), true); assert.equal(counter, 2); }); @@ -331,7 +331,7 @@ describe('MentionSendingService', function () { `); - assert.deepStrictEqual(links, [ + assert.deepEqual(links, [ new URL('https://example.com'), new URL('https://example.org#fragment'), new URL('http://example2.org') @@ -343,7 +343,7 @@ describe('MentionSendingService', function () { getSiteUrl: () => new URL('https://site.com') }); const links = service.getLinks(`Example`); - assert.deepStrictEqual(links, []); + assert.deepEqual(links, []); }); it('Does not include non-http protocols', async function () { @@ -351,7 +351,7 @@ describe('MentionSendingService', function () { getSiteUrl: () => new URL('https://site.com') }); const links = service.getLinks(`Example`); - assert.deepStrictEqual(links, []); + assert.deepEqual(links, []); }); it('Does not include invalid urls', async function () { @@ -359,7 +359,7 @@ describe('MentionSendingService', function () { getSiteUrl: () => new URL('https://site.com') }); const links = service.getLinks(`Example`); - assert.deepStrictEqual(links, []); + assert.deepEqual(links, []); }); it('Does not include urls from site domain', async function () { @@ -367,7 +367,7 @@ describe('MentionSendingService', function () { getSiteUrl: () => new URL('https://site.com') }); const links = service.getLinks(`Example`); - assert.deepStrictEqual(links, []); + assert.deepEqual(links, []); }); it('Ignores invalid site urls', async function () { @@ -375,7 +375,7 @@ describe('MentionSendingService', function () { getSiteUrl: () => new URL('invalid()') }); const links = service.getLinks(`Example`); - assert.deepStrictEqual(links, [ + assert.deepEqual(links, [ new URL('http://site.com/test?123') ]); }); diff --git a/ghost/webmentions/test/MentionsAPI.test.js b/ghost/webmentions/test/MentionsAPI.test.js index 53413f7e59..de53f4d87b 100644 --- a/ghost/webmentions/test/MentionsAPI.test.js +++ b/ghost/webmentions/test/MentionsAPI.test.js @@ -1,4 +1,4 @@ -const assert = require('assert'); +const assert = require('assert/strict'); const ObjectID = require('bson-objectid'); const Mention = require('../lib/Mention'); const MentionsAPI = require('../lib/MentionsAPI');