Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion ghost/core/test/e2e-api/admin/actions.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const assert = require('node:assert/strict');
const should = require('should');
const sinon = require('sinon');
const supertest = require('supertest');
Expand Down Expand Up @@ -132,7 +133,7 @@ describe('Actions API', function () {
res5.body.actions[0].event.should.eql('edited');
Object.keys(res5.body.actions[0].actor).length.should.eql(4);
res5.body.actions[0].actor.id.should.eql(testUtils.DataGenerator.Content.integrations[0].id);
should.equal(res5.body.actions[0].actor.image, null);
assert.equal(res5.body.actions[0].actor.image, null);
res5.body.actions[0].actor.name.should.eql(testUtils.DataGenerator.Content.integrations[0].name);
res5.body.actions[0].actor.slug.should.eql(testUtils.DataGenerator.Content.integrations[0].slug);
});
Expand Down
61 changes: 31 additions & 30 deletions ghost/core/test/e2e-api/admin/integrations.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const assert = require('node:assert/strict');
const _ = require('lodash');
const should = require('should');
const supertest = require('supertest');
Expand Down Expand Up @@ -25,7 +26,7 @@ describe('Integrations API', function () {
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(200);

should.equal(res.body.integrations.length, 6);
assert.equal(res.body.integrations.length, 6);

// there is no enforced order for integrations which makes order different on SQLite and MySQL
const zapierIntegration = _.find(res.body.integrations, {name: 'Zapier'}); // from migrations
Expand Down Expand Up @@ -61,24 +62,24 @@ describe('Integrations API', function () {
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(201);

should.equal(res.body.integrations.length, 1);
assert.equal(res.body.integrations.length, 1);

const [integration] = res.body.integrations;
should.equal(integration.name, 'Dis-Integrate!!');
assert.equal(integration.name, 'Dis-Integrate!!');

should.equal(integration.api_keys.length, 2);
assert.equal(integration.api_keys.length, 2);

const contentApiKey = integration.api_keys.find(findBy('type', 'content'));
should.equal(contentApiKey.integration_id, integration.id);
assert.equal(contentApiKey.integration_id, integration.id);

const adminApiKey = integration.api_keys.find(findBy('type', 'admin'));
should.equal(adminApiKey.integration_id, integration.id);
assert.equal(adminApiKey.integration_id, integration.id);
should.exist(adminApiKey.secret);

// check Admin API key secret format
const [id, secret] = adminApiKey.secret.split(':');
should.exist(id);
should.equal(id, adminApiKey.id);
assert.equal(id, adminApiKey.id);
should.exist(secret);
secret.length.should.equal(64);

Expand All @@ -102,15 +103,15 @@ describe('Integrations API', function () {
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(201);

should.equal(res.body.integrations.length, 1);
assert.equal(res.body.integrations.length, 1);

const [integration] = res.body.integrations;
should.equal(integration.name, 'Integratatron4000');
assert.equal(integration.name, 'Integratatron4000');

should.equal(integration.webhooks.length, 1);
assert.equal(integration.webhooks.length, 1);

const webhook = integration.webhooks[0];
should.equal(webhook.integration_id, integration.id);
assert.equal(webhook.integration_id, integration.id);

should.exist(res.headers.location);
res.headers.location.should.equal(`http://127.0.0.1:2369${localUtils.API.getApiQuery('integrations/')}${res.body.integrations[0].id}/`);
Expand All @@ -134,15 +135,15 @@ describe('Integrations API', function () {
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(200);

should.equal(res2.body.integrations.length, 1);
assert.equal(res2.body.integrations.length, 1);

const [integration] = res2.body.integrations;

should.equal(integration.id, createdIntegration.id);
should.equal(integration.name, createdIntegration.name);
should.equal(integration.slug, createdIntegration.slug);
should.equal(integration.description, createdIntegration.description);
should.equal(integration.icon_image, createdIntegration.icon_image);
assert.equal(integration.id, createdIntegration.id);
assert.equal(integration.name, createdIntegration.name);
assert.equal(integration.slug, createdIntegration.slug);
assert.equal(integration.description, createdIntegration.description);
assert.equal(integration.icon_image, createdIntegration.icon_image);
});

it('Can successfully get *all* created integrations with api_keys', async function () {
Expand Down Expand Up @@ -172,10 +173,10 @@ describe('Integrations API', function () {

const body = res.body;
// This is the only page
should.equal(body.meta.pagination.page, 1);
should.equal(body.meta.pagination.pages, 1);
should.equal(body.meta.pagination.next, null);
should.equal(body.meta.pagination.prev, null);
assert.equal(body.meta.pagination.page, 1);
assert.equal(body.meta.pagination.pages, 1);
assert.equal(body.meta.pagination.next, null);
assert.equal(body.meta.pagination.prev, null);

body.integrations.forEach((integration) => {
should.exist(integration.api_keys);
Expand All @@ -184,9 +185,9 @@ describe('Integrations API', function () {
should.exist(apiKey.secret);

if (apiKey.type === 'content') {
should.equal(apiKey.secret.split(':').length, 1, `${integration.name} api key secret should have correct key format without ":"`);
assert.equal(apiKey.secret.split(':').length, 1, `${integration.name} api key secret should have correct key format without ":"`);
} else if (apiKey.type === 'admin') {
should.equal(apiKey.secret.split(':').length, 2, `${integration.name} api key secret should have correct key format with ":"`);
assert.equal(apiKey.secret.split(':').length, 2, `${integration.name} api key secret should have correct key format with ":"`);
}
});
}
Expand Down Expand Up @@ -223,9 +224,9 @@ describe('Integrations API', function () {

const [updatedIntegration] = res2.body.integrations;

should.equal(updatedIntegration.id, createdIntegration.id);
should.equal(updatedIntegration.name, 'Awesome Integration Name');
should.equal(updatedIntegration.description, 'Finally got round to writing this...');
assert.equal(updatedIntegration.id, createdIntegration.id);
assert.equal(updatedIntegration.name, 'Awesome Integration Name');
assert.equal(updatedIntegration.description, 'Finally got round to writing this...');
});

it('Can successfully refresh an integration api key', async function () {
Expand Down Expand Up @@ -259,7 +260,7 @@ describe('Integrations API', function () {

const [updatedIntegration] = res2.body.integrations;
const updatedAdminApiKey = updatedIntegration.api_keys.find(key => key.type === 'admin');
should.equal(updatedIntegration.id, createdIntegration.id);
assert.equal(updatedIntegration.id, createdIntegration.id);
updatedAdminApiKey.secret.should.not.eql(adminApiKey.secret);

const res3 = await request.get(localUtils.API.getApiQuery(`actions/?filter=resource_id:'${adminApiKey.id}'&include=actor`))
Expand Down Expand Up @@ -307,10 +308,10 @@ describe('Integrations API', function () {

const [updatedIntegration] = res2.body.integrations;

should.equal(updatedIntegration.webhooks.length, 1);
assert.equal(updatedIntegration.webhooks.length, 1);

const webhook = updatedIntegration.webhooks[0];
should.equal(webhook.integration_id, updatedIntegration.id);
assert.equal(webhook.integration_id, updatedIntegration.id);

await request.put(localUtils.API.getApiQuery(`integrations/${createdIntegration.id}/`))
.set('Origin', config.get('url'))
Expand All @@ -328,7 +329,7 @@ describe('Integrations API', function () {
.expect(200);

const [updatedIntegration2] = res3.body.integrations;
should.equal(updatedIntegration2.webhooks.length, 0);
assert.equal(updatedIntegration2.webhooks.length, 0);
});

it('Can successfully delete a created integration', async function () {
Expand Down
8 changes: 4 additions & 4 deletions ghost/core/test/e2e-api/admin/members-importer.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ describe('Members Importer API', function () {
// should.exist(jsonResponse.meta);
// should.exist(jsonResponse.meta.stats);
// should.exist(jsonResponse.meta.stats.successful);
// should.equal(jsonResponse.meta.stats.successful, 8);
// assert.equal(jsonResponse.meta.stats.successful, 8);
// })
// .then(() => importLabel);
// })
Expand Down Expand Up @@ -214,7 +214,7 @@ describe('Members Importer API', function () {
should.exist(bulkUnsubscribeResponse.body.bulk.meta);
should.exist(bulkUnsubscribeResponse.body.bulk.meta.stats);
should.exist(bulkUnsubscribeResponse.body.bulk.meta.stats.successful);
should.equal(bulkUnsubscribeResponse.body.bulk.meta.stats.successful, 8);
assert.equal(bulkUnsubscribeResponse.body.bulk.meta.stats.successful, 8);

const postUnsubscribeBrowseResponse = await request
.get(localUtils.API.getApiQuery('members/?filter=label:bulk-unsubscribe-test'))
Expand Down Expand Up @@ -270,7 +270,7 @@ describe('Members Importer API', function () {
should.exist(bulkAddLabelResponse.body.bulk.meta);
should.exist(bulkAddLabelResponse.body.bulk.meta.stats);
should.exist(bulkAddLabelResponse.body.bulk.meta.stats.successful);
should.equal(bulkAddLabelResponse.body.bulk.meta.stats.successful, 8);
assert.equal(bulkAddLabelResponse.body.bulk.meta.stats.successful, 8);

const postLabelAddBrowseResponse = await request
.get(localUtils.API.getApiQuery(`members/?filter=label:${labelToAdd.slug}`))
Expand Down Expand Up @@ -302,7 +302,7 @@ describe('Members Importer API', function () {
should.exist(bulkRemoveLabelResponse.body.bulk.meta);
should.exist(bulkRemoveLabelResponse.body.bulk.meta.stats);
should.exist(bulkRemoveLabelResponse.body.bulk.meta.stats.successful);
should.equal(bulkRemoveLabelResponse.body.bulk.meta.stats.successful, 8);
assert.equal(bulkRemoveLabelResponse.body.bulk.meta.stats.successful, 8);

const postLabelRemoveBrowseResponse = await request
.get(localUtils.API.getApiQuery(`members/?filter=label:${labelToRemove.slug}`))
Expand Down
11 changes: 6 additions & 5 deletions ghost/core/test/e2e-api/admin/pages-legacy.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const assert = require('node:assert/strict');
const should = require('should');
const supertest = require('supertest');
const moment = require('moment');
Expand Down Expand Up @@ -124,8 +125,8 @@ describe('Pages API', function () {
const additionalProperties = ['reading_time'];
localUtils.API.checkResponse(returnedPage, 'page', additionalProperties);

should.equal(returnedPage.mobiledoc, page.mobiledoc);
should.equal(returnedPage.lexical, null);
assert.equal(returnedPage.mobiledoc, page.mobiledoc);
assert.equal(returnedPage.lexical, null);
});

it('Can add a page with lexical', async function () {
Expand Down Expand Up @@ -175,9 +176,9 @@ describe('Pages API', function () {
const additionalProperties = ['html', 'reading_time'];
localUtils.API.checkResponse(returnedPage, 'page', additionalProperties);

should.equal(returnedPage.mobiledoc, null);
should.equal(returnedPage.lexical, page.lexical);
should.equal(returnedPage.html, '<p>Testing page creation with lexical</p>');
assert.equal(returnedPage.mobiledoc, null);
assert.equal(returnedPage.lexical, page.lexical);
assert.equal(returnedPage.html, '<p>Testing page creation with lexical</p>');
});

it('Can\'t add a page with both mobiledoc and lexical', async function () {
Expand Down
3 changes: 2 additions & 1 deletion ghost/core/test/e2e-api/admin/posts-legacy.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const assert = require('node:assert/strict');
const should = require('should');
const nock = require('nock');
const path = require('path');
Expand Down Expand Up @@ -160,7 +161,7 @@ describe('Posts API', function () {
.expect(200);

const jsonResponse = res.body;
should.equal(jsonResponse.meta.pagination.page, 2);
assert.equal(jsonResponse.meta.pagination.page, 2);
});

it('Can request a post by id', async function () {
Expand Down
3 changes: 2 additions & 1 deletion ghost/core/test/e2e-api/admin/tags.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const assert = require('node:assert/strict');
const should = require('should');
const sinon = require('sinon');
const supertest = require('supertest');
Expand Down Expand Up @@ -60,7 +61,7 @@ describe('Tag API', function () {
.expect('Cache-Control', testUtils.cacheRules.private)
.expect(200);

should.equal(res.body.meta.pagination.page, 2);
assert.equal(res.body.meta.pagination.page, 2);
});

it('Can read a tag', async function () {
Expand Down
4 changes: 2 additions & 2 deletions ghost/core/test/e2e-api/members-comments/comments.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -870,10 +870,10 @@ describe('Comments API', function () {

// Check last updated_at is not changed?
loggedInMember = await models.Member.findOne({id: loggedInMember.id});
should.equal(loggedInMember.get('last_seen_at').getTime(), date.getTime(), 'The member should not update `last_seen_at` if last seen at is same day');
assert.equal(loggedInMember.get('last_seen_at').getTime(), date.getTime(), 'The member should not update `last_seen_at` if last seen at is same day');

// Check last_commented_at changed?
should.equal(loggedInMember.get('last_commented_at').getTime(), date.getTime(), 'The member should not update `last_commented_at` f last seen at is same day');
assert.equal(loggedInMember.get('last_commented_at').getTime(), date.getTime(), 'The member should not update `last_commented_at` f last seen at is same day');
});

it('Can reply to a comment', async function () {
Expand Down
2 changes: 1 addition & 1 deletion ghost/core/test/e2e-frontend/members.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ describe('Front-end members behavior', function () {
'sort_order'
]);

should.equal(restoreJsonResponse.newsletters[0].name, originalNewsletterName);
assert.equal(restoreJsonResponse.newsletters[0].name, originalNewsletterName);
});
});

Expand Down
3 changes: 2 additions & 1 deletion ghost/core/test/integration/exporter/exporter.test.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
const assert = require('node:assert/strict');
const should = require('should');
const sinon = require('sinon');
const testUtils = require('../../utils');
Expand Down Expand Up @@ -132,7 +133,7 @@ describe('Exporter', function () {

excludedTables.forEach((tableName) => {
// NOTE: why is this undefined? The key should probably not even be present
should.equal(exportData.data[tableName], undefined);
assert.equal(exportData.data[tableName], undefined);
});

// excludes settings with sensitive data
Expand Down
12 changes: 6 additions & 6 deletions ghost/core/test/integration/importer/v2.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,9 @@ describe('Importer', function () {
return models.Settings.findOne(_.merge({key: 'labs'}, testUtils.context.internal));
})
.then(function (result) {
should.equal(result.attributes.key, 'labs');
should.equal(result.attributes.group, 'labs');
should.equal(result.attributes.value, '{"additionalPaymentMethods":true}');
assert.equal(result.attributes.key, 'labs');
assert.equal(result.attributes.group, 'labs');
assert.equal(result.attributes.value, '{"additionalPaymentMethods":true}');
});
});

Expand All @@ -807,9 +807,9 @@ describe('Importer', function () {
return models.Settings.findOne(_.merge({key: 'labs'}, testUtils.context.internal));
})
.then(function (result) {
should.equal(result.attributes.key, 'labs');
should.equal(result.attributes.group, 'labs');
should.equal(result.attributes.value, '{}');
assert.equal(result.attributes.key, 'labs');
assert.equal(result.attributes.group, 'labs');
assert.equal(result.attributes.value, '{}');
});
});

Expand Down
Loading