mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-08 02:52:39 -05:00
Updated misc files to use ES6 variables
- updated various files I noticed were outdated on my travels around the codebase - doesn't make any more advanced ES6 changes, this is mostly in the persuit of getting rid of var x = y, z = a; lists at the top of files
This commit is contained in:
parent
4e9889ea4f
commit
18bd10308b
11 changed files with 116 additions and 112 deletions
18
index.js
18
index.js
|
@ -1,25 +1,25 @@
|
|||
// # Ghost Startup
|
||||
// Orchestrates the startup of Ghost when run from command line.
|
||||
|
||||
var startTime = Date.now(),
|
||||
debug = require('ghost-ignition').debug('boot:index'),
|
||||
sentry = require('./core/server/sentry'),
|
||||
ghost, express, common, urlService, parentApp;
|
||||
const startTime = Date.now();
|
||||
const debug = require('ghost-ignition').debug('boot:index');
|
||||
const sentry = require('./core/server/sentry');
|
||||
|
||||
debug('First requires...');
|
||||
|
||||
ghost = require('./core');
|
||||
const ghost = require('./core');
|
||||
|
||||
debug('Required ghost');
|
||||
|
||||
express = require('express');
|
||||
common = require('./core/server/lib/common');
|
||||
urlService = require('./core/frontend/services/url');
|
||||
parentApp = express();
|
||||
const express = require('express');
|
||||
const common = require('./core/server/lib/common');
|
||||
const urlService = require('./core/frontend/services/url');
|
||||
const parentApp = express();
|
||||
|
||||
parentApp.use(sentry.requestHandler);
|
||||
|
||||
debug('Initialising Ghost');
|
||||
|
||||
ghost().then(function (ghostServer) {
|
||||
// Mount our Ghost instance on our desired subdirectory path if it exists.
|
||||
parentApp.use(urlService.utils.getSubdir(), ghostServer.rootApp);
|
||||
|
|
|
@ -5,21 +5,22 @@
|
|||
// As it stands, these tests depend on the database, and as such are integration tests.
|
||||
// Mocking out the models to not touch the DB would turn these into unit tests, and should probably be done in future,
|
||||
// But then again testing real code, rather than mock code, might be more useful...
|
||||
var should = require('should'),
|
||||
sinon = require('sinon'),
|
||||
supertest = require('supertest'),
|
||||
moment = require('moment'),
|
||||
cheerio = require('cheerio'),
|
||||
_ = require('lodash'),
|
||||
testUtils = require('../utils'),
|
||||
configUtils = require('../utils/configUtils'),
|
||||
config = require('../../core/server/config'),
|
||||
settingsCache = require('../../core/server/services/settings/cache'),
|
||||
origCache = _.cloneDeep(settingsCache),
|
||||
ghost = testUtils.startGhost,
|
||||
request;
|
||||
const should = require('should');
|
||||
const sinon = require('sinon');
|
||||
const supertest = require('supertest');
|
||||
const moment = require('moment');
|
||||
const cheerio = require('cheerio');
|
||||
const _ = require('lodash');
|
||||
const testUtils = require('../utils');
|
||||
const configUtils = require('../utils/configUtils');
|
||||
const config = require('../../core/server/config');
|
||||
const settingsCache = require('../../core/server/services/settings/cache');
|
||||
const origCache = _.cloneDeep(settingsCache);
|
||||
const ghost = testUtils.startGhost;
|
||||
|
||||
describe('Default Frontend routing', function () {
|
||||
let request;
|
||||
|
||||
function doEnd(done) {
|
||||
return function (err, res) {
|
||||
if (err) {
|
||||
|
@ -71,7 +72,7 @@ describe('Default Frontend routing', function () {
|
|||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
var $ = cheerio.load(res.text);
|
||||
const $ = cheerio.load(res.text);
|
||||
|
||||
// NOTE: "Ghost" is the title from the settings.
|
||||
$('title').text().should.equal('Ghost');
|
||||
|
@ -90,7 +91,7 @@ describe('Default Frontend routing', function () {
|
|||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
var $ = cheerio.load(res.text);
|
||||
const $ = cheerio.load(res.text);
|
||||
|
||||
// NOTE: "Ghost" is the title from the settings.
|
||||
$('title').text().should.equal('Ghost - Ghost');
|
||||
|
@ -109,7 +110,7 @@ describe('Default Frontend routing', function () {
|
|||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
var $ = cheerio.load(res.text);
|
||||
const $ = cheerio.load(res.text);
|
||||
|
||||
// NOTE: "Ghost" is the title from the settings.
|
||||
$('title').text().should.equal('Getting Started - Ghost');
|
||||
|
@ -130,7 +131,7 @@ describe('Default Frontend routing', function () {
|
|||
.expect('Cache-Control', testUtils.cacheRules.public)
|
||||
.expect(200)
|
||||
.end(function (err, res) {
|
||||
var $ = cheerio.load(res.text);
|
||||
const $ = cheerio.load(res.text);
|
||||
|
||||
// NOTE: This is the title from the settings.
|
||||
$('title').text().should.equal('Welcome to Ghost');
|
||||
|
@ -146,7 +147,7 @@ describe('Default Frontend routing', function () {
|
|||
|
||||
it('should not work with date permalinks', function (done) {
|
||||
// get today's date
|
||||
var date = moment().format('YYYY/MM/DD');
|
||||
const date = moment().format('YYYY/MM/DD');
|
||||
|
||||
request.get('/' + date + '/welcome/')
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
|
@ -212,7 +213,7 @@ describe('Default Frontend routing', function () {
|
|||
return done(err);
|
||||
}
|
||||
|
||||
var $ = cheerio.load(res.text);
|
||||
const $ = cheerio.load(res.text);
|
||||
|
||||
should.not.exist(res.headers['x-cache-invalidate']);
|
||||
should.not.exist(res.headers['X-CSRF-Token']);
|
||||
|
@ -232,7 +233,7 @@ describe('Default Frontend routing', function () {
|
|||
|
||||
it('should not work with date permalinks', function (done) {
|
||||
// get today's date
|
||||
var date = moment().format('YYYY/MM/DD');
|
||||
const date = moment().format('YYYY/MM/DD');
|
||||
|
||||
request.get('/' + date + '/welcome/amp/')
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
var should = require('should'),
|
||||
sinon = require('sinon'),
|
||||
rewire = require('rewire'),
|
||||
urlUtils = require('../../../../utils/urlUtils'),
|
||||
cors = rewire('../../../../../core/server/web/api/middleware/cors');
|
||||
const should = require('should');
|
||||
const sinon = require('sinon');
|
||||
const rewire = require('rewire');
|
||||
const urlUtils = require('../../../../utils/urlUtils');
|
||||
|
||||
let cors = rewire('../../../../../core/server/web/api/middleware/cors');
|
||||
|
||||
describe('cors', function () {
|
||||
var res, req, next;
|
||||
let res, req, next;
|
||||
|
||||
beforeEach(function () {
|
||||
req = {
|
||||
|
@ -44,7 +45,7 @@ describe('cors', function () {
|
|||
});
|
||||
|
||||
it('should be enabled when origin is 127.0.0.1', function (done) {
|
||||
var origin = 'http://127.0.0.1:2368';
|
||||
const origin = 'http://127.0.0.1:2368';
|
||||
|
||||
req.get = sinon.stub().withArgs('origin').returns(origin);
|
||||
res.get = sinon.stub().withArgs('origin').returns(origin);
|
||||
|
@ -59,7 +60,7 @@ describe('cors', function () {
|
|||
});
|
||||
|
||||
it('should be enabled when origin is localhost', function (done) {
|
||||
var origin = 'http://localhost:2368';
|
||||
const origin = 'http://localhost:2368';
|
||||
|
||||
req.get = sinon.stub().withArgs('origin').returns(origin);
|
||||
res.get = sinon.stub().withArgs('origin').returns(origin);
|
||||
|
@ -74,7 +75,7 @@ describe('cors', function () {
|
|||
});
|
||||
|
||||
it('should not be enabled the if origin is not whitelisted', function (done) {
|
||||
var origin = 'http://not-trusted.com';
|
||||
const origin = 'http://not-trusted.com';
|
||||
|
||||
req.get = sinon.stub().withArgs('origin').returns(origin);
|
||||
res.get = sinon.stub().withArgs('origin').returns(origin);
|
||||
|
@ -89,7 +90,7 @@ describe('cors', function () {
|
|||
});
|
||||
|
||||
it('should be enabled if the origin matches config.url', function (done) {
|
||||
var origin = 'http://my.blog';
|
||||
const origin = 'http://my.blog';
|
||||
|
||||
cors.__set__('urlUtils', urlUtils.getInstance({url: origin}));
|
||||
|
||||
|
@ -106,7 +107,7 @@ describe('cors', function () {
|
|||
});
|
||||
|
||||
it('should be enabled if the origin matches config.url', function (done) {
|
||||
var origin = 'http://admin:2222';
|
||||
const origin = 'http://admin:2222';
|
||||
|
||||
cors.__set__('urlUtils', urlUtils.getInstance({
|
||||
url: 'https://blog',
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
var should = require('should'),
|
||||
sinon = require('sinon'),
|
||||
versionMatch = require('../../../../../core/server/web/api/middleware/version-match');
|
||||
const should = require('should');
|
||||
const sinon = require('sinon');
|
||||
const versionMatch = require('../../../../../core/server/web/api/middleware/version-match');
|
||||
|
||||
describe('Version Mismatch', function () {
|
||||
var req, res, getStub, nextStub;
|
||||
let req, res, getStub, nextStub;
|
||||
|
||||
afterEach(function () {
|
||||
sinon.restore();
|
||||
});
|
||||
|
@ -33,7 +34,7 @@ describe('Version Mismatch', function () {
|
|||
}
|
||||
|
||||
it('should call next if request does not include a version', function () {
|
||||
var server = '1.5.1';
|
||||
const server = '1.5.1';
|
||||
|
||||
testVersionMatch(server);
|
||||
|
||||
|
@ -42,8 +43,8 @@ describe('Version Mismatch', function () {
|
|||
});
|
||||
|
||||
it('should call next if versions are an exact match', function () {
|
||||
var server = '1.5.0',
|
||||
client = '1.5';
|
||||
const server = '1.5.0';
|
||||
const client = '1.5';
|
||||
|
||||
testVersionMatch(server, client);
|
||||
|
||||
|
@ -52,8 +53,8 @@ describe('Version Mismatch', function () {
|
|||
});
|
||||
|
||||
it('should call next if client version is earlier than server', function () {
|
||||
var server = '1.5.0',
|
||||
client = '1.3';
|
||||
const server = '1.5.0';
|
||||
const client = '1.3';
|
||||
|
||||
testVersionMatch(server, client);
|
||||
|
||||
|
@ -62,8 +63,8 @@ describe('Version Mismatch', function () {
|
|||
});
|
||||
|
||||
it('should throw VersionMismatchError if client version is earlier by a major version', function () {
|
||||
var server = '2.5.0',
|
||||
client = '1.3';
|
||||
const server = '2.5.0';
|
||||
const client = '1.3';
|
||||
|
||||
testVersionMatch(server, client);
|
||||
|
||||
|
@ -74,8 +75,8 @@ describe('Version Mismatch', function () {
|
|||
});
|
||||
|
||||
it('should throw VersionMismatchError if client version is later than server', function () {
|
||||
var server = '1.3.0',
|
||||
client = '1.5';
|
||||
const server = '1.3.0';
|
||||
const client = '1.5';
|
||||
|
||||
testVersionMatch(server, client);
|
||||
|
||||
|
@ -86,8 +87,8 @@ describe('Version Mismatch', function () {
|
|||
});
|
||||
|
||||
it('should throw VersionMismatchError if client version is later by a major version', function () {
|
||||
var server = '1.5.0',
|
||||
client = '2.3';
|
||||
const server = '1.5.0';
|
||||
const client = '2.3';
|
||||
|
||||
testVersionMatch(server, client);
|
||||
|
||||
|
@ -98,8 +99,8 @@ describe('Version Mismatch', function () {
|
|||
});
|
||||
|
||||
it('should call next if pre-release is allowed', function () {
|
||||
var server = '1.5.0-pre',
|
||||
client = '1.4';
|
||||
const server = '1.5.0-pre';
|
||||
const client = '1.4';
|
||||
|
||||
testVersionMatch(server, client);
|
||||
|
||||
|
@ -108,8 +109,8 @@ describe('Version Mismatch', function () {
|
|||
});
|
||||
|
||||
it('throws error if server is a pre-release, but later by major version', function () {
|
||||
var server = '2.0.0-alpha',
|
||||
client = '1.5';
|
||||
const server = '2.0.0-alpha';
|
||||
const client = '1.5';
|
||||
|
||||
testVersionMatch(server, client);
|
||||
|
||||
|
|
|
@ -5,7 +5,8 @@ const validator = require('validator');
|
|||
const requestId = require('../../../../../core/server/web/parent/middleware/request-id');
|
||||
|
||||
describe('Request ID middleware', function () {
|
||||
var res, req, next;
|
||||
let res, req, next;
|
||||
|
||||
beforeEach(function () {
|
||||
req = {
|
||||
get: sinon.stub()
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
var should = require('should'),
|
||||
sinon = require('sinon'),
|
||||
cacheControl = require('../../../../../core/server/web/shared/middlewares/cache-control');
|
||||
const should = require('should');
|
||||
const sinon = require('sinon');
|
||||
const cacheControl = require('../../../../../core/server/web/shared/middlewares/cache-control');
|
||||
|
||||
describe('Middleware: cacheControl', function () {
|
||||
var res;
|
||||
let res;
|
||||
|
||||
beforeEach(function () {
|
||||
res = {
|
||||
|
@ -53,8 +53,8 @@ describe('Middleware: cacheControl', function () {
|
|||
});
|
||||
|
||||
it('will not get confused between serving public and private', function (done) {
|
||||
var publicCC = cacheControl('public'),
|
||||
privateCC = cacheControl('private');
|
||||
const publicCC = cacheControl('public');
|
||||
const privateCC = cacheControl('private');
|
||||
|
||||
publicCC(null, res, function () {
|
||||
res.set.calledOnce.should.be.true();
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
var should = require('should'),
|
||||
sinon = require('sinon'),
|
||||
uncapitalise = require('../../../../../core/server/web/shared/middlewares/uncapitalise');
|
||||
const should = require('should');
|
||||
const sinon = require('sinon');
|
||||
const uncapitalise = require('../../../../../core/server/web/shared/middlewares/uncapitalise');
|
||||
|
||||
// NOTE: all urls will have had trailing slashes added before uncapitalise is called
|
||||
|
||||
describe('Middleware: uncapitalise', function () {
|
||||
var res, req, next;
|
||||
let res, req, next;
|
||||
|
||||
beforeEach(function () {
|
||||
res = {
|
||||
|
@ -174,30 +174,30 @@ describe('Middleware: uncapitalise', function () {
|
|||
});
|
||||
|
||||
it('does not convert any capitals after the endpoint', function (done) {
|
||||
var query = '?filter=mAgic';
|
||||
const query = '?filter=mAgic';
|
||||
req.path = `/Ghost/API/${apiVersion}/settings/is_private/`;
|
||||
req.url = req.path + query;
|
||||
req.url = `${req.path}${query}`;
|
||||
|
||||
uncapitalise(req, res, next);
|
||||
|
||||
next.called.should.be.false();
|
||||
res.redirect.calledOnce.should.be.true();
|
||||
res.redirect.calledWith(301, `/ghost/api/${apiVersion}/settings/is_private/?filter=mAgic`).should.be.true();
|
||||
res.redirect.calledWith(301, `/ghost/api/${apiVersion}/settings/is_private/${query}`).should.be.true();
|
||||
done();
|
||||
});
|
||||
|
||||
it('does not convert any capitals after the endpoint with baseUrl', function (done) {
|
||||
var query = '?filter=mAgic';
|
||||
const query = '?filter=mAgic';
|
||||
req.baseUrl = '/Blog';
|
||||
req.path = `/ghost/api/${apiVersion}/mail/test@example.COM/`;
|
||||
req.url = req.path + query;
|
||||
req.originalUrl = req.baseUrl + req.path + query;
|
||||
req.url = `${req.path}${query}`;
|
||||
req.originalUrl = `${req.baseUrl}${req.path}${query}`;
|
||||
|
||||
uncapitalise(req, res, next);
|
||||
|
||||
next.called.should.be.false();
|
||||
res.redirect.calledOnce.should.be.true();
|
||||
res.redirect.calledWith(301, `/blog/ghost/api/${apiVersion}/mail/test@example.COM/?filter=mAgic`).should.be.true();
|
||||
res.redirect.calledWith(301, `/blog/ghost/api/${apiVersion}/mail/test@example.COM/${query}`).should.be.true();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -9,7 +9,7 @@ const getFrontendRedirectUrl = urlRedirects.__get__('_private.getFrontendRedirec
|
|||
const redirect = urlRedirects.__get__('_private.redirect');
|
||||
|
||||
describe('UNIT: url redirects', function () {
|
||||
var res, req, next, host;
|
||||
let res, req, next, host;
|
||||
|
||||
beforeEach(function () {
|
||||
req = {
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
var should = require('should'),
|
||||
sinon = require('sinon'),
|
||||
express = require('express'),
|
||||
serveFavicon = require('../../../../../core/server/web/site/middleware/serve-favicon'),
|
||||
settingsCache = require('../../../../../core/server/services/settings/cache'),
|
||||
storage = require('../../../../../core/server/adapters/storage'),
|
||||
configUtils = require('../../../../utils/configUtils'),
|
||||
path = require('path');
|
||||
const should = require('should');
|
||||
const sinon = require('sinon');
|
||||
const express = require('express');
|
||||
const serveFavicon = require('../../../../../core/server/web/site/middleware/serve-favicon');
|
||||
const settingsCache = require('../../../../../core/server/services/settings/cache');
|
||||
const storage = require('../../../../../core/server/adapters/storage');
|
||||
const configUtils = require('../../../../utils/configUtils');
|
||||
const path = require('path');
|
||||
|
||||
describe('Serve Favicon', function () {
|
||||
var req, res, next, blogApp, localSettingsCache = {}, originalStoragePath;
|
||||
let req, res, next, blogApp, localSettingsCache = {}, originalStoragePath;
|
||||
|
||||
beforeEach(function () {
|
||||
req = sinon.spy();
|
||||
|
@ -33,13 +33,13 @@ describe('Serve Favicon', function () {
|
|||
|
||||
describe('serveFavicon', function () {
|
||||
it('should return a middleware', function () {
|
||||
var middleware = serveFavicon();
|
||||
const middleware = serveFavicon();
|
||||
|
||||
middleware.should.be.a.Function();
|
||||
});
|
||||
|
||||
it('should skip if the request does NOT match the file', function () {
|
||||
var middleware = serveFavicon();
|
||||
const middleware = serveFavicon();
|
||||
req.path = '/robots.txt';
|
||||
middleware(req, res, next);
|
||||
next.called.should.be.true();
|
||||
|
@ -47,7 +47,7 @@ describe('Serve Favicon', function () {
|
|||
|
||||
describe('serves', function () {
|
||||
it('custom uploaded favicon.png', function (done) {
|
||||
var middleware = serveFavicon();
|
||||
const middleware = serveFavicon();
|
||||
req.path = '/favicon.png';
|
||||
|
||||
storage.getStorage().storagePath = path.join(__dirname, '../../../../../test/utils/fixtures/images/');
|
||||
|
@ -67,7 +67,7 @@ describe('Serve Favicon', function () {
|
|||
});
|
||||
|
||||
it('custom uploaded favicon.ico', function (done) {
|
||||
var middleware = serveFavicon();
|
||||
const middleware = serveFavicon();
|
||||
req.path = '/favicon.ico';
|
||||
|
||||
storage.getStorage().storagePath = path.join(__dirname, '../../../../../test/utils/fixtures/images/');
|
||||
|
@ -87,7 +87,7 @@ describe('Serve Favicon', function () {
|
|||
});
|
||||
|
||||
it('custom uploaded myicon.ico', function (done) {
|
||||
var middleware = serveFavicon();
|
||||
const middleware = serveFavicon();
|
||||
req.path = '/favicon.ico';
|
||||
|
||||
storage.getStorage().storagePath = path.join(__dirname, '../../../../../test/utils/fixtures/images/');
|
||||
|
@ -107,7 +107,7 @@ describe('Serve Favicon', function () {
|
|||
});
|
||||
|
||||
it('default favicon.ico', function (done) {
|
||||
var middleware = serveFavicon();
|
||||
const middleware = serveFavicon();
|
||||
req.path = '/favicon.ico';
|
||||
localSettingsCache.icon = '';
|
||||
|
||||
|
@ -127,7 +127,7 @@ describe('Serve Favicon', function () {
|
|||
|
||||
describe('redirects', function () {
|
||||
it('to custom favicon.ico when favicon.png is requested', function (done) {
|
||||
var middleware = serveFavicon();
|
||||
const middleware = serveFavicon();
|
||||
req.path = '/favicon.png';
|
||||
|
||||
configUtils.set('paths:contentPath', path.join(__dirname, '../../../../../test/utils/fixtures/'));
|
||||
|
@ -144,7 +144,7 @@ describe('Serve Favicon', function () {
|
|||
});
|
||||
|
||||
it('to custom favicon.png when favicon.ico is requested', function (done) {
|
||||
var middleware = serveFavicon();
|
||||
const middleware = serveFavicon();
|
||||
req.path = '/favicon.ico';
|
||||
|
||||
configUtils.set('paths:contentPath', path.join(__dirname, '../../../../../test/utils/fixtures/'));
|
||||
|
@ -161,7 +161,7 @@ describe('Serve Favicon', function () {
|
|||
});
|
||||
|
||||
it('to favicon.ico when favicon.png is requested', function (done) {
|
||||
var middleware = serveFavicon();
|
||||
const middleware = serveFavicon();
|
||||
req.path = '/favicon.png';
|
||||
|
||||
configUtils.set('paths:publicFilePath', path.join(__dirname, '../../../../../test/utils/fixtures/'));
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
var should = require('should'),
|
||||
sinon = require('sinon'),
|
||||
fs = require('fs-extra'),
|
||||
servePublicFile = require('../../../../../core/server/web/site/middleware/serve-public-file');
|
||||
const should = require('should');
|
||||
const sinon = require('sinon');
|
||||
const fs = require('fs-extra');
|
||||
const servePublicFile = require('../../../../../core/server/web/site/middleware/serve-public-file');
|
||||
|
||||
describe('servePublicFile', function () {
|
||||
var res, req, next;
|
||||
let res, req, next;
|
||||
|
||||
beforeEach(function () {
|
||||
res = sinon.spy();
|
||||
|
@ -17,20 +17,20 @@ describe('servePublicFile', function () {
|
|||
});
|
||||
|
||||
it('should return a middleware', function () {
|
||||
var result = servePublicFile('robots.txt', 'text/plain', 3600);
|
||||
const result = servePublicFile('robots.txt', 'text/plain', 3600);
|
||||
|
||||
result.should.be.a.Function();
|
||||
});
|
||||
|
||||
it('should skip if the request does NOT match the file', function () {
|
||||
var middleware = servePublicFile('robots.txt', 'text/plain', 3600);
|
||||
const middleware = servePublicFile('robots.txt', 'text/plain', 3600);
|
||||
req.path = '/favicon.ico';
|
||||
middleware(req, res, next);
|
||||
next.called.should.be.true();
|
||||
});
|
||||
|
||||
it('should load the file and send it', function () {
|
||||
var middleware = servePublicFile('robots.txt', 'text/plain', 3600),
|
||||
const middleware = servePublicFile('robots.txt', 'text/plain', 3600),
|
||||
body = 'User-agent: * Disallow: /';
|
||||
req.path = '/robots.txt';
|
||||
|
||||
|
@ -56,7 +56,7 @@ describe('servePublicFile', function () {
|
|||
});
|
||||
|
||||
it('should send the correct headers', function () {
|
||||
var middleware = servePublicFile('robots.txt', 'text/plain', 3600),
|
||||
const middleware = servePublicFile('robots.txt', 'text/plain', 3600),
|
||||
body = 'User-agent: * Disallow: /';
|
||||
req.path = '/robots.txt';
|
||||
|
||||
|
@ -80,7 +80,7 @@ describe('servePublicFile', function () {
|
|||
});
|
||||
|
||||
it('should replace {{blog-url}} in text/plain', function () {
|
||||
var middleware = servePublicFile('robots.txt', 'text/plain', 3600),
|
||||
const middleware = servePublicFile('robots.txt', 'text/plain', 3600),
|
||||
body = 'User-agent: {{blog-url}}';
|
||||
req.path = '/robots.txt';
|
||||
|
||||
|
|
|
@ -1,12 +1,12 @@
|
|||
var should = require('should'),
|
||||
sinon = require('sinon'),
|
||||
const should = require('should');
|
||||
const sinon = require('sinon');
|
||||
|
||||
express = require('express'),
|
||||
themeUtils = require('../../../../../core/frontend/services/themes'),
|
||||
staticTheme = require('../../../../../core/server/web/site/middleware/static-theme');
|
||||
const express = require('express');
|
||||
const themeUtils = require('../../../../../core/frontend/services/themes');
|
||||
const staticTheme = require('../../../../../core/server/web/site/middleware/static-theme');
|
||||
|
||||
describe('staticTheme', function () {
|
||||
var expressStaticStub, activeThemeStub, req, res;
|
||||
let expressStaticStub, activeThemeStub, req, res;
|
||||
|
||||
beforeEach(function () {
|
||||
req = {};
|
||||
|
|
Loading…
Add table
Reference in a new issue