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` seeaa58b354a4
- Null and undefined are not the same thing, there were a few cases of this being confused - Particularly questionable changes in [PostExporter tests](c1a468744b
) tracked [here](https://github.com/TryGhost/Team/issues/3505). - A typo seeeaac9c293a
Moving forward, using assert strict should help us to catch unexpected behaviour, particularly around nulls and undefineds during implementation.
This commit is contained in:
parent
3e932458a4
commit
6161f94910
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
|
||||
describe('Hello world', function () {
|
||||
it('Runs a test', function () {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const MemoryTTLCache = require('../index');
|
||||
|
||||
const sleep = ms => (
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const sinon = require('sinon');
|
||||
const RedisCache = require('../index');
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
|
||||
describe('Hello world', function () {
|
||||
it('Runs a test', function () {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const AnnouncementBarSettings = require('../index');
|
||||
|
||||
describe('AnnouncementBarSettings', function () {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const sinon = require('sinon');
|
||||
const APIVersionCompatibilityService = require('../index');
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const {AudienceFeedbackService} = require('../index');
|
||||
|
||||
describe('audienceFeedbackService', function () {
|
||||
|
@ -15,7 +15,7 @@ module.exports = (url) => {
|
||||
|
||||
let {version, api} = pathMatch(apiRouteMatcher)(urlToMatch);
|
||||
|
||||
if (version === [null]) {
|
||||
if (version === undefined) {
|
||||
version = null;
|
||||
}
|
||||
|
||||
|
@ -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');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const {
|
||||
agentProvider,
|
||||
fixtureManager,
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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/', '');
|
||||
|
@ -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');
|
||||
|
@ -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;
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
@ -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');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const {
|
||||
agentProvider,
|
||||
fixtureManager,
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const moment = require('moment');
|
||||
|
||||
const testUtils = require('../../utils');
|
||||
|
@ -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'`);
|
||||
}
|
||||
});
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const should = require('should');
|
||||
const supertest = require('supertest');
|
||||
const _ = require('lodash');
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const http = require('http');
|
||||
const path = require('path');
|
||||
|
||||
|
@ -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');
|
||||
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
||||
|
@ -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');
|
||||
|
@ -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',
|
||||
|
@ -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 () {
|
||||
|
@ -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');
|
||||
|
@ -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 () {
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const path = require('path');
|
||||
|
||||
const glob = require('glob');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const sinon = require('sinon');
|
||||
const should = require('should');
|
||||
|
||||
|
@ -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) => {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const generateExcerpt = require('../../../../core/frontend/meta/generate-excerpt');
|
||||
|
||||
describe('generateExcerpt', function () {
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
|
||||
const MemoryCache = require('../../../../../core/server/adapters/cache/MemoryCache');
|
||||
|
||||
|
@ -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 = [{
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const events = require('../../../../core/server/lib/common/events');
|
||||
|
||||
describe('Events', function () {
|
||||
|
@ -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 () {
|
||||
|
@ -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 () {
|
||||
|
@ -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 () {
|
||||
|
@ -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;
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const Suppression = require('../../../../core/server/models/suppression');
|
||||
|
||||
describe('Suppression', function () {
|
||||
|
@ -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');
|
||||
|
||||
|
@ -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/');
|
||||
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
||||
|
@ -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 () {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const sinon = require('sinon');
|
||||
|
||||
const models = require('../../../../../core/server/models');
|
||||
|
@ -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;
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const sinon = require('sinon');
|
||||
const rewire = require('rewire');
|
||||
|
||||
|
@ -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 = {
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -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 () {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
|
||||
describe('Milestones Service', function () {
|
||||
let milestonesService;
|
||||
|
@ -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;
|
||||
|
@ -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');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const NFTOembedProvider = require('../../../../../core/server/services/oembed/NFTOEmbedProvider');
|
||||
|
||||
describe('NFTOEmbedProvider', function () {
|
||||
|
@ -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');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const sinon = require('sinon');
|
||||
const ObjectId = require('bson-objectid').default;
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const sinon = require('sinon');
|
||||
|
||||
// To test
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
|
||||
describe('Segment Analytics Service', function () {
|
||||
let segmentService;
|
||||
|
@ -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');
|
||||
|
@ -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);
|
||||
});
|
||||
});
|
||||
|
@ -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');
|
||||
|
@ -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');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
|
||||
const Resources = require('../../../../../core/server/services/url/Resources');
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const sinon = require('sinon');
|
||||
|
||||
const Users = require('../../../../../core/server/services/Users');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
|
||||
const models = require('../../../../../core/server/models');
|
||||
|
||||
|
@ -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');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const sinon = require('sinon');
|
||||
const configUtils = require('../../utils/configUtils');
|
||||
|
||||
|
@ -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');
|
||||
|
||||
|
@ -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');
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const events = require('../index');
|
||||
|
||||
describe('Dynamic Routing Events', function () {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const {URLResourceUpdatedEvent} = require('../../index');
|
||||
|
||||
describe('URLResourceUpdatedEvent', function () {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const path = require('path');
|
||||
|
||||
const EmailContentGenerator = require('../index');
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const events = require('../');
|
||||
|
||||
describe('index.js', function () {
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const ObjectID = require('bson-objectid').default;
|
||||
const EmailBouncedEvent = require('../../lib/EmailBouncedEvent');
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const ObjectID = require('bson-objectid').default;
|
||||
const EmailDeliveredEvent = require('../../lib/EmailDeliveredEvent');
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const ObjectID = require('bson-objectid').default;
|
||||
const EmailOpenedEvent = require('../../lib/EmailOpenedEvent');
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const ObjectID = require('bson-objectid').default;
|
||||
const EmailTemporaryBouncedEvent = require('../../lib/EmailTemporaryBouncedEvent');
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const ObjectID = require('bson-objectid').default;
|
||||
const EmailUnsubscribedEvent = require('../../lib/EmailUnsubscribedEvent');
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
const assert = require('assert');
|
||||
const assert = require('assert/strict');
|
||||
const ObjectID = require('bson-objectid').default;
|
||||
const SpamComplaintEvent = require('../../lib/SpamComplaintEvent');
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user