mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-08 02:52:39 -05:00
Removed final non-destructured imports of core/server/lib/common (#11858)
* removed final non-destructured imports of core/server/lib/common * fixed lint
This commit is contained in:
parent
c2f5ed07d9
commit
c7127d5a93
13 changed files with 24 additions and 35 deletions
|
@ -3,7 +3,7 @@ const should = require('should');
|
|||
const supertest = require('supertest');
|
||||
const sinon = require('sinon');
|
||||
const config = require('../../../core/shared/config');
|
||||
const common = require('../../../core/server/lib/common');
|
||||
const {events} = require('../../../core/server/lib/common');
|
||||
const testUtils = require('../../utils');
|
||||
const localUtils = require('./utils');
|
||||
|
||||
|
@ -28,7 +28,7 @@ describe('DB API', function () {
|
|||
beforeEach(function () {
|
||||
eventsTriggered = {};
|
||||
|
||||
sinon.stub(common.events, 'emit').callsFake((eventName, eventObj) => {
|
||||
sinon.stub(events, 'emit').callsFake((eventName, eventObj) => {
|
||||
if (!eventsTriggered[eventName]) {
|
||||
eventsTriggered[eventName] = [];
|
||||
}
|
||||
|
|
|
@ -7,8 +7,7 @@ const should = require('should');
|
|||
const supertest = require('supertest');
|
||||
const sinon = require('sinon');
|
||||
const config = require('../../../../../core/shared/config');
|
||||
const models = require('../../../../../core/server/models');
|
||||
const common = require('../../../../../core/server/lib/common');
|
||||
const {events} = require('../../../../../core/server/lib/common');
|
||||
const testUtils = require('../../../../utils');
|
||||
const localUtils = require('./utils');
|
||||
|
||||
|
@ -37,7 +36,7 @@ describe('DB API', function () {
|
|||
beforeEach(function () {
|
||||
eventsTriggered = {};
|
||||
|
||||
sinon.stub(common.events, 'emit').callsFake((eventName, eventObj) => {
|
||||
sinon.stub(events, 'emit').callsFake((eventName, eventObj) => {
|
||||
if (!eventsTriggered[eventName]) {
|
||||
eventsTriggered[eventName] = [];
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ const sinon = require('sinon');
|
|||
const testUtils = require('../../../../utils');
|
||||
const localUtils = require('./utils');
|
||||
const config = require('../../../../../core/shared/config');
|
||||
const common = require('../../../../../core/server/lib/common');
|
||||
const {events} = require('../../../../../core/server/lib/common');
|
||||
const ghost = testUtils.startGhost;
|
||||
|
||||
let request;
|
||||
|
@ -27,7 +27,7 @@ describe('Slack API', function () {
|
|||
});
|
||||
|
||||
it('Can post slack test', function (done) {
|
||||
const eventSpy = sinon.spy(common.events, 'emit');
|
||||
const eventSpy = sinon.spy(events, 'emit');
|
||||
request.post(localUtils.API.getApiQuery('slack/test/'))
|
||||
.set('Origin', config.get('url'))
|
||||
.expect('Content-Type', /json/)
|
||||
|
|
|
@ -7,8 +7,7 @@ const should = require('should');
|
|||
const supertest = require('supertest');
|
||||
const sinon = require('sinon');
|
||||
const config = require('../../../../../core/shared/config');
|
||||
const models = require('../../../../../core/server/models');
|
||||
const common = require('../../../../../core/server/lib/common');
|
||||
const {events} = require('../../../../../core/server/lib/common');
|
||||
const testUtils = require('../../../../utils');
|
||||
const localUtils = require('./utils');
|
||||
|
||||
|
@ -37,7 +36,7 @@ describe('DB API', function () {
|
|||
beforeEach(function () {
|
||||
eventsTriggered = {};
|
||||
|
||||
sinon.stub(common.events, 'emit').callsFake((eventName, eventObj) => {
|
||||
sinon.stub(events, 'emit').callsFake((eventName, eventObj) => {
|
||||
if (!eventsTriggered[eventName]) {
|
||||
eventsTriggered[eventName] = [];
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ const sinon = require('sinon');
|
|||
const testUtils = require('../../../../utils');
|
||||
const localUtils = require('./utils');
|
||||
const config = require('../../../../../core/shared/config');
|
||||
const common = require('../../../../../core/server/lib/common');
|
||||
const {events} = require('../../../../../core/server/lib/common');
|
||||
const ghost = testUtils.startGhost;
|
||||
|
||||
let request;
|
||||
|
@ -27,7 +27,7 @@ describe('Slack API', function () {
|
|||
});
|
||||
|
||||
it('Can post slack test', function (done) {
|
||||
const eventSpy = sinon.spy(common.events, 'emit');
|
||||
const eventSpy = sinon.spy(events, 'emit');
|
||||
request.post(localUtils.API.getApiQuery('slack/test/'))
|
||||
.set('Origin', config.get('url'))
|
||||
.expect('Content-Type', /json/)
|
||||
|
|
|
@ -7,8 +7,7 @@ const should = require('should');
|
|||
const supertest = require('supertest');
|
||||
const sinon = require('sinon');
|
||||
const config = require('../../../../../core/shared/config');
|
||||
const models = require('../../../../../core/server/models');
|
||||
const common = require('../../../../../core/server/lib/common');
|
||||
const {events} = require('../../../../../core/server/lib/common');
|
||||
const testUtils = require('../../../../utils');
|
||||
const localUtils = require('./utils');
|
||||
|
||||
|
@ -37,7 +36,7 @@ describe('DB API', function () {
|
|||
beforeEach(function () {
|
||||
eventsTriggered = {};
|
||||
|
||||
sinon.stub(common.events, 'emit').callsFake((eventName, eventObj) => {
|
||||
sinon.stub(events, 'emit').callsFake((eventName, eventObj) => {
|
||||
if (!eventsTriggered[eventName]) {
|
||||
eventsTriggered[eventName] = [];
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ const sinon = require('sinon');
|
|||
const testUtils = require('../../../../utils');
|
||||
const localUtils = require('./utils');
|
||||
const config = require('../../../../../core/shared/config');
|
||||
const common = require('../../../../../core/server/lib/common');
|
||||
const {events} = require('../../../../../core/server/lib/common');
|
||||
const ghost = testUtils.startGhost;
|
||||
|
||||
let request;
|
||||
|
@ -27,7 +27,7 @@ describe('Slack API', function () {
|
|||
});
|
||||
|
||||
it('Can post slack test', function (done) {
|
||||
const eventSpy = sinon.spy(common.events, 'emit');
|
||||
const eventSpy = sinon.spy(events, 'emit');
|
||||
request.post(localUtils.API.getApiQuery('slack/test/'))
|
||||
.set('Origin', config.get('url'))
|
||||
.expect('Content-Type', /json/)
|
||||
|
|
|
@ -2,7 +2,7 @@ const should = require('should');
|
|||
const sinon = require('sinon');
|
||||
|
||||
// Stuff we are testing
|
||||
const common = require('../../../../../core/server/lib/common');
|
||||
const {events} = require('../../../../../core/server/lib/common');
|
||||
|
||||
const SiteMapManager = require('../../../../../core/frontend/services/sitemap/manager');
|
||||
const PostGenerator = require('../../../../../core/frontend/services/sitemap/post-generator');
|
||||
|
@ -33,7 +33,7 @@ describe('Unit: sitemap/manager', function () {
|
|||
beforeEach(function () {
|
||||
eventsToRemember = {};
|
||||
|
||||
sinon.stub(common.events, 'on').callsFake(function (eventName, callback) {
|
||||
sinon.stub(events, 'on').callsFake(function (eventName, callback) {
|
||||
eventsToRemember[eventName] = callback;
|
||||
});
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@ const sinon = require('sinon');
|
|||
const mockDb = require('mock-knex');
|
||||
const models = require('../../../core/server/models');
|
||||
const {knex} = require('../../../core/server/data/db');
|
||||
const common = require('../../../core/server/lib/common');
|
||||
const {events} = require('../../../core/server/lib/common');
|
||||
|
||||
describe('Unit: models/settings', function () {
|
||||
before(function () {
|
||||
|
@ -25,7 +25,7 @@ describe('Unit: models/settings', function () {
|
|||
});
|
||||
|
||||
beforeEach(function () {
|
||||
eventSpy = sinon.spy(common.events, 'emit');
|
||||
eventSpy = sinon.spy(events, 'emit');
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
|
@ -99,7 +99,7 @@ describe('Unit: models/settings', function () {
|
|||
});
|
||||
|
||||
beforeEach(function () {
|
||||
eventSpy = sinon.spy(common.events, 'emit');
|
||||
eventSpy = sinon.spy(events, 'emit');
|
||||
});
|
||||
|
||||
afterEach(function () {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
const should = require('should');
|
||||
const sinon = require('sinon');
|
||||
const configUtils = require('../../../utils/configUtils');
|
||||
const common = require('../../../../core/server/lib/common');
|
||||
const {events} = require('../../../../core/server/lib/common');
|
||||
const urlUtils = require('../../../../core/shared/url-utils');
|
||||
const ParentRouter = require('../../../../core/frontend/services/routing/ParentRouter');
|
||||
|
||||
|
@ -11,8 +11,8 @@ describe('UNIT - services/routing/ParentRouter', function () {
|
|||
let next;
|
||||
|
||||
beforeEach(function () {
|
||||
sinon.stub(common.events, 'emit');
|
||||
sinon.stub(common.events, 'on');
|
||||
sinon.stub(events, 'emit');
|
||||
sinon.stub(events, 'on');
|
||||
|
||||
sinon.stub(urlUtils, 'redirect301');
|
||||
|
||||
|
|
|
@ -1,8 +1,5 @@
|
|||
const should = require('should');
|
||||
const sinon = require('sinon');
|
||||
const _ = require('lodash');
|
||||
const testUtils = require('../../../../utils');
|
||||
const common = require('../../../../../core/server/lib/common');
|
||||
const security = require('../../../../../core/server/lib/security');
|
||||
const settingsCache = require('../../../../../core/server/services/settings/cache');
|
||||
const controllers = require('../../../../../core/frontend/services/routing/controllers');
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
const sinon = require('sinon');
|
||||
const should = require('should');
|
||||
const fs = require('fs-extra');
|
||||
const yaml = require('js-yaml');
|
||||
const path = require('path');
|
||||
const configUtils = require('../../../utils/configUtils');
|
||||
const common = require('../../../../core/server/lib/common');
|
||||
const ensureSettings = require('../../../../core/frontend/services/settings/ensure-settings');
|
||||
|
||||
describe('UNIT > Settings Service ensure settings:', function () {
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
const _ = require('lodash');
|
||||
const Promise = require('bluebird');
|
||||
const should = require('should');
|
||||
const jsonpath = require('jsonpath');
|
||||
const sinon = require('sinon');
|
||||
const common = require('../../../../core/server/lib/common');
|
||||
const {events} = require('../../../../core/server/lib/common');
|
||||
const Urls = require('../../../../core/frontend/services/url/Urls');
|
||||
|
||||
describe('Unit: services/url/Urls', function () {
|
||||
|
@ -44,7 +41,7 @@ describe('Unit: services/url/Urls', function () {
|
|||
});
|
||||
|
||||
eventsToRemember = {};
|
||||
sinon.stub(common.events, 'emit').callsFake(function (eventName, data) {
|
||||
sinon.stub(events, 'emit').callsFake(function (eventName, data) {
|
||||
eventsToRemember[eventName] = data;
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue