Moved frontend unit tests into their own folder

- this is a small part of a bit of cleanup of our test files
- the goal is to make the existing tests clearer with a view to making it easier to write more tests
- this makes the test structure follow the codebase structure more closely
- eventually we will colocate the frontend tests with the frontend code
This commit is contained in:
Hannah Wolfe 2021-10-06 10:52:46 +01:00
parent e849167472
commit 95d27e7f58
No known key found for this signature in database
GPG Key ID: 9F8C7532D0A6BA55
110 changed files with 295 additions and 295 deletions

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
// Stuff we are testing // Stuff we are testing
const ampComponentsHelper = require('../../../../core/frontend/apps/amp/lib/helpers/amp_components'); const ampComponentsHelper = require('../../../../../core/frontend/apps/amp/lib/helpers/amp_components');
describe('{{amp_components}} helper', function () { describe('{{amp_components}} helper', function () {
it('adds script tag for a gif', function () { it('adds script tag for a gif', function () {

View File

@ -1,8 +1,8 @@
const should = require('should'); const should = require('should');
const rewire = require('rewire'); const rewire = require('rewire');
const nock = require('nock'); const nock = require('nock');
const urlUtils = require('../../../utils/urlUtils'); const urlUtils = require('../../../../utils/urlUtils');
const ampContentHelper = rewire('../../../../core/frontend/apps/amp/lib/helpers/amp_content'); const ampContentHelper = rewire('../../../../../core/frontend/apps/amp/lib/helpers/amp_content');
// TODO: Amperize really needs to get stubbed, so we can test returning errors // TODO: Amperize really needs to get stubbed, so we can test returning errors
// properly and make this test faster! // properly and make this test faster!

View File

@ -2,11 +2,11 @@ const errors = require('@tryghost/errors');
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const path = require('path'); const path = require('path');
const ampController = require('../../../../core/frontend/apps/amp/lib/router'); const ampController = require('../../../../../core/frontend/apps/amp/lib/router');
const urlService = require('../../../../core/frontend/services/url'); const urlService = require('../../../../../core/frontend/services/url');
const helpers = require('../../../../core/frontend/services/routing/helpers'); const helpers = require('../../../../../core/frontend/services/routing/helpers');
const testUtils = require('../../../utils'); const testUtils = require('../../../../utils');
const configUtils = require('../../../utils/configUtils'); const configUtils = require('../../../../utils/configUtils');
// Helper function to prevent unit tests // Helper function to prevent unit tests
// from failing via timeout when they // from failing via timeout when they

View File

@ -1,9 +1,9 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const path = require('path'); const path = require('path');
const configUtils = require('../../../utils/configUtils'); const configUtils = require('../../../../utils/configUtils');
const themeEngine = require('../../../../core/frontend/services/theme-engine'); const themeEngine = require('../../../../../core/frontend/services/theme-engine');
const privateController = require('../../../../core/frontend/apps/private-blogging/lib/router'); const privateController = require('../../../../../core/frontend/apps/private-blogging/lib/router');
describe('Private Controller', function () { describe('Private Controller', function () {
let res; let res;

View File

@ -2,7 +2,7 @@
const should = require('should'); const should = require('should');
// Stuff we are testing // Stuff we are testing
const input_password = require('../../../../core/frontend/apps/private-blogging/lib/helpers/input_password'); const input_password = require('../../../../../core/frontend/apps/private-blogging/lib/helpers/input_password');
describe('{{input_password}} helper', function () { describe('{{input_password}} helper', function () {
it('has input_password helper', function () { it('has input_password helper', function () {

View File

@ -3,8 +3,8 @@ const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const crypto = require('crypto'); const crypto = require('crypto');
const fs = require('fs-extra'); const fs = require('fs-extra');
const settingsCache = require('../../../../core/shared/settings-cache'); const settingsCache = require('../../../../../core/shared/settings-cache');
const privateBlogging = require('../../../../core/frontend/apps/private-blogging/lib/middleware'); const privateBlogging = require('../../../../../core/frontend/apps/private-blogging/lib/middleware');
function hash(password, salt) { function hash(password, salt) {
const hasher = crypto.createHash('sha256'); const hasher = crypto.createHash('sha256');

View File

@ -4,9 +4,9 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const configUtils = require('../../utils/configUtils'); const configUtils = require('../../../utils/configUtils');
const asset = require('../../../core/frontend/helpers/asset'); const asset = require('../../../../core/frontend/helpers/asset');
const settingsCache = require('../../../core/shared/settings-cache'); const settingsCache = require('../../../../core/shared/settings-cache');
describe('{{asset}} helper', function () { describe('{{asset}} helper', function () {
let rendered; let rendered;

View File

@ -1,8 +1,8 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const testUtils = require('../../utils'); const testUtils = require('../../../utils');
const urlService = require('../../../core/frontend/services/url'); const urlService = require('../../../../core/frontend/services/url');
const authorHelper = require('../../../core/frontend/helpers/author'); const authorHelper = require('../../../../core/frontend/helpers/author');
describe('{{author}} helper', function () { describe('{{author}} helper', function () {
beforeEach(function () { beforeEach(function () {

View File

@ -1,9 +1,9 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const urlService = require('../../../core/frontend/services/url'); const urlService = require('../../../../core/frontend/services/url');
const authorsHelper = require('../../../core/frontend/helpers/authors'); const authorsHelper = require('../../../../core/frontend/helpers/authors');
const models = require('../../../core/server/models'); const models = require('../../../../core/server/models');
const testUtils = require('../../utils'); const testUtils = require('../../../utils');
describe('{{authors}} helper', function () { describe('{{authors}} helper', function () {
before(function () { before(function () {

View File

@ -1,8 +1,8 @@
const should = require('should'); const should = require('should');
const themeList = require('../../../core/server/services/themes/list'); const themeList = require('../../../../core/server/services/themes/list');
// Stuff we are testing // Stuff we are testing
const body_class = require('../../../core/frontend/helpers/body_class'); const body_class = require('../../../../core/frontend/helpers/body_class');
describe('{{body_class}} helper', function () { describe('{{body_class}} helper', function () {
let options = {}; let options = {};

View File

@ -1,9 +1,9 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const hbs = require('../../../core/frontend/services/theme-engine/engine'); const hbs = require('../../../../core/frontend/services/theme-engine/engine');
const cancel_link = require('../../../core/frontend/helpers/cancel_link'); const cancel_link = require('../../../../core/frontend/helpers/cancel_link');
const labs = require('../../../core/shared/labs'); const labs = require('../../../../core/shared/labs');
const configUtils = require('../../utils/configUtils'); const configUtils = require('../../../utils/configUtils');
describe('{{cancel_link}} helper', function () { describe('{{cancel_link}} helper', function () {
let labsStub; let labsStub;

View File

@ -1,10 +1,10 @@
const should = require('should'); const should = require('should');
const handlebars = require('../../../core/frontend/services/theme-engine/engine').handlebars; const handlebars = require('../../../../core/frontend/services/theme-engine/engine').handlebars;
const concat = require('../../../core/frontend/helpers/concat'); const concat = require('../../../../core/frontend/helpers/concat');
const url = require('../../../core/frontend/helpers/url'); const url = require('../../../../core/frontend/helpers/url');
const configUtils = require('../../utils/configUtils'); const configUtils = require('../../../utils/configUtils');
let defaultGlobals; let defaultGlobals;

View File

@ -1,10 +1,10 @@
const should = require('should'); const should = require('should');
const hbs = require('../../../core/frontend/services/theme-engine/engine'); const hbs = require('../../../../core/frontend/services/theme-engine/engine');
const configUtils = require('../../utils/configUtils'); const configUtils = require('../../../utils/configUtils');
const path = require('path'); const path = require('path');
// Stuff we are testing // Stuff we are testing
const content = require('../../../core/frontend/helpers/content'); const content = require('../../../../core/frontend/helpers/content');
describe('{{content}} helper', function () { describe('{{content}} helper', function () {
before(function (done) { before(function (done) {

View File

@ -2,7 +2,7 @@ const sinon = require('sinon');
const should = require('should'); const should = require('should');
// Stuff we are testing // Stuff we are testing
const date = require('../../../core/frontend/helpers/date'); const date = require('../../../../core/frontend/helpers/date');
const moment = require('moment-timezone'); const moment = require('moment-timezone');

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
// Stuff we are testing // Stuff we are testing
const encode = require('../../../core/frontend/helpers/encode'); const encode = require('../../../../core/frontend/helpers/encode');
describe('{{encode}} helper', function () { describe('{{encode}} helper', function () {
it('can escape URI', function () { it('can escape URI', function () {

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
// Stuff we are testing // Stuff we are testing
const excerpt = require('../../../core/frontend/helpers/excerpt'); const excerpt = require('../../../../core/frontend/helpers/excerpt');
describe('{{excerpt}} Helper', function () { describe('{{excerpt}} Helper', function () {
it('renders empty string when html, excerpt, and custom_excerpt are null', function () { it('renders empty string when html, excerpt, and custom_excerpt are null', function () {

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
// Stuff we are testing // Stuff we are testing
const facebook_url = require('../../../core/frontend/helpers/facebook_url'); const facebook_url = require('../../../../core/frontend/helpers/facebook_url');
describe('{{facebook_url}} helper', function () { describe('{{facebook_url}} helper', function () {
const options = {data: {site: {}}}; const options = {data: {site: {}}};

View File

@ -1,8 +1,8 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const _ = require('lodash'); const _ = require('lodash');
const foreach = require('../../../core/frontend/helpers/foreach'); const foreach = require('../../../../core/frontend/helpers/foreach');
const handlebars = require('../../../core/frontend/services/theme-engine/engine').handlebars; const handlebars = require('../../../../core/frontend/services/theme-engine/engine').handlebars;
describe('{{#foreach}} helper', function () { describe('{{#foreach}} helper', function () {
let options; let options;

View File

@ -1,13 +1,13 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const Promise = require('bluebird'); const Promise = require('bluebird');
const {SafeString} = require('../../../core/frontend/services/rendering'); const {SafeString} = require('../../../../core/frontend/services/rendering');
// Stuff we are testing // Stuff we are testing
const get = require('../../../core/frontend/helpers/get'); const get = require('../../../../core/frontend/helpers/get');
const models = require('../../../core/server/models'); const models = require('../../../../core/server/models');
const api = require('../../../core/server/api'); const api = require('../../../../core/server/api');
describe('{{#get}} helper', function () { describe('{{#get}} helper', function () {
let fn; let fn;

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const ghost_foot = require('../../../core/frontend/helpers/ghost_foot'); const ghost_foot = require('../../../../core/frontend/helpers/ghost_foot');
const {settingsCache} = require('../../../core/frontend/services/proxy'); const {settingsCache} = require('../../../../core/frontend/services/proxy');
describe('{{ghost_foot}} helper', function () { describe('{{ghost_foot}} helper', function () {
let settingsCacheStub; let settingsCacheStub;

View File

@ -4,16 +4,16 @@ const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const _ = require('lodash'); const _ = require('lodash');
const moment = require('moment'); const moment = require('moment');
const testUtils = require('../../utils'); const testUtils = require('../../../utils');
const configUtils = require('../../utils/configUtils'); const configUtils = require('../../../utils/configUtils');
const themeEngine = require('../../../core/frontend/services/theme-engine'); const themeEngine = require('../../../../core/frontend/services/theme-engine');
const models = require('../../../core/server/models'); const models = require('../../../../core/server/models');
const imageLib = require('../../../core/server/lib/image'); const imageLib = require('../../../../core/server/lib/image');
const routing = require('../../../core/frontend/services/routing'); const routing = require('../../../../core/frontend/services/routing');
const urlService = require('../../../core/frontend/services/url'); const urlService = require('../../../../core/frontend/services/url');
const ghost_head = require('../../../core/frontend/helpers/ghost_head'); const ghost_head = require('../../../../core/frontend/helpers/ghost_head');
const {settingsCache} = require('../../../core/frontend/services/proxy'); const {settingsCache} = require('../../../../core/frontend/services/proxy');
describe('{{ghost_head}} helper', function () { describe('{{ghost_head}} helper', function () {
let posts = []; let posts = [];

View File

@ -2,7 +2,7 @@ const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
// Stuff we are testing // Stuff we are testing
const has = require('../../../core/frontend/helpers/has'); const has = require('../../../../core/frontend/helpers/has');
describe('{{#has}} helper', function () { describe('{{#has}} helper', function () {
let fn; let fn;

View File

@ -1,9 +1,9 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const configUtils = require('../../utils/configUtils'); const configUtils = require('../../../utils/configUtils');
// Stuff we are testing // Stuff we are testing
const img_url = require('../../../core/frontend/helpers/img_url'); const img_url = require('../../../../core/frontend/helpers/img_url');
const logging = require('@tryghost/logging'); const logging = require('@tryghost/logging');

View File

@ -1,5 +1,5 @@
const sinon = require('sinon'); const sinon = require('sinon');
const is = require('../../../core/frontend/helpers/is'); const is = require('../../../../core/frontend/helpers/is');
const logging = require('@tryghost/logging'); const logging = require('@tryghost/logging');
describe('{{#is}} helper', function () { describe('{{#is}} helper', function () {

View File

@ -1,5 +1,5 @@
const should = require('should'); const should = require('should');
const lang = require('../../../core/frontend/helpers/lang'); const lang = require('../../../../core/frontend/helpers/lang');
describe('{{lang}} helper', function () { describe('{{lang}} helper', function () {
it('returns correct language tag', function () { it('returns correct language tag', function () {

View File

@ -1,10 +1,10 @@
const should = require('should'); const should = require('should');
const concat = require('../../../core/frontend/helpers/concat'); const concat = require('../../../../core/frontend/helpers/concat');
const link = require('../../../core/frontend/helpers/link'); const link = require('../../../../core/frontend/helpers/link');
const url = require('../../../core/frontend/helpers/url'); const url = require('../../../../core/frontend/helpers/url');
const handlebars = require('../../../core/frontend/services/theme-engine/engine').handlebars; const handlebars = require('../../../../core/frontend/services/theme-engine/engine').handlebars;
const configUtils = require('../../utils/configUtils'); const configUtils = require('../../../utils/configUtils');
let defaultGlobals; let defaultGlobals;

View File

@ -1,9 +1,9 @@
const should = require('should'); const should = require('should');
const concat = require('../../../core/frontend/helpers/concat'); const concat = require('../../../../core/frontend/helpers/concat');
const link_class = require('../../../core/frontend/helpers/link_class'); const link_class = require('../../../../core/frontend/helpers/link_class');
const handlebars = require('../../../core/frontend/services/theme-engine/engine').handlebars; const handlebars = require('../../../../core/frontend/services/theme-engine/engine').handlebars;
const configUtils = require('../../utils/configUtils'); const configUtils = require('../../../utils/configUtils');
let defaultGlobals; let defaultGlobals;

View File

@ -1,9 +1,9 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const _ = require('lodash'); const _ = require('lodash');
const match = require('../../../core/frontend/helpers/match'); const match = require('../../../../core/frontend/helpers/match');
const labs = require('../../../core/shared/labs'); const labs = require('../../../../core/shared/labs');
const handlebars = require('../../../core/frontend/services/theme-engine/engine').handlebars; const handlebars = require('../../../../core/frontend/services/theme-engine/engine').handlebars;
describe('Match helper', function () { describe('Match helper', function () {
before(function () { before(function () {

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const meta_description = require('../../../core/frontend/helpers/meta_description'); const meta_description = require('../../../../core/frontend/helpers/meta_description');
const settingsCache = require('../../../core/shared/settings-cache'); const settingsCache = require('../../../../core/shared/settings-cache');
describe('{{meta_description}} helper', function () { describe('{{meta_description}} helper', function () {
const localSettingsCache = {}; const localSettingsCache = {};

View File

@ -1,8 +1,8 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const configUtils = require('../../utils/configUtils'); const configUtils = require('../../../utils/configUtils');
const meta_title = require('../../../core/frontend/helpers/meta_title'); const meta_title = require('../../../../core/frontend/helpers/meta_title');
const settingsCache = require('../../../core/shared/settings-cache'); const settingsCache = require('../../../../core/shared/settings-cache');
describe('{{meta_title}} helper', function () { describe('{{meta_title}} helper', function () {
describe('no meta_title', function () { describe('no meta_title', function () {

View File

@ -1,15 +1,15 @@
const should = require('should'); const should = require('should');
const hbs = require('../../../core/frontend/services/theme-engine/engine'); const hbs = require('../../../../core/frontend/services/theme-engine/engine');
const configUtils = require('../../utils/configUtils'); const configUtils = require('../../../utils/configUtils');
const path = require('path'); const path = require('path');
const concat = require('../../../core/frontend/helpers/concat'); const concat = require('../../../../core/frontend/helpers/concat');
const foreach = require('../../../core/frontend/helpers/foreach'); const foreach = require('../../../../core/frontend/helpers/foreach');
const link_class = require('../../../core/frontend/helpers/link_class'); const link_class = require('../../../../core/frontend/helpers/link_class');
const url = require('../../../core/frontend/helpers/url'); const url = require('../../../../core/frontend/helpers/url');
const navigation = require('../../../core/frontend/helpers/navigation'); const navigation = require('../../../../core/frontend/helpers/navigation');
const handlebars = require('../../../core/frontend/services/theme-engine/engine').handlebars; const handlebars = require('../../../../core/frontend/services/theme-engine/engine').handlebars;
const runHelper = data => navigation.call({}, data); const runHelper = data => navigation.call({}, data);
const runHelperThunk = data => () => runHelper(data); const runHelperThunk = data => () => runHelper(data);

View File

@ -1,9 +1,9 @@
const errors = require('@tryghost/errors'); const errors = require('@tryghost/errors');
const sinon = require('sinon'); const sinon = require('sinon');
const Promise = require('bluebird'); const Promise = require('bluebird');
const markdownToMobiledoc = require('../../utils/fixtures/data-generator').markdownToMobiledoc; const markdownToMobiledoc = require('../../../utils/fixtures/data-generator').markdownToMobiledoc;
const next_post = require('../../../core/frontend/helpers/prev_post'); const next_post = require('../../../../core/frontend/helpers/prev_post');
const api = require('../../../core/server/api'); const api = require('../../../../core/server/api');
describe('{{next_post}} helper', function () { describe('{{next_post}} helper', function () {
const apiVersion = 'canary'; const apiVersion = 'canary';

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
// Stuff we are testing // Stuff we are testing
const page_url = require('../../../core/frontend/helpers/page_url'); const page_url = require('../../../../core/frontend/helpers/page_url');
describe('{{page_url}} helper', function () { describe('{{page_url}} helper', function () {
const options = {data: {root: {pagination: {}}}}; const options = {data: {root: {pagination: {}}}};

View File

@ -1,9 +1,9 @@
const should = require('should'); const should = require('should');
const hbs = require('../../../core/frontend/services/theme-engine/engine'); const hbs = require('../../../../core/frontend/services/theme-engine/engine');
const configUtils = require('../../utils/configUtils'); const configUtils = require('../../../utils/configUtils');
const path = require('path'); const path = require('path');
const page_url = require('../../../core/frontend/helpers/page_url'); const page_url = require('../../../../core/frontend/helpers/page_url');
const pagination = require('../../../core/frontend/helpers/pagination'); const pagination = require('../../../../core/frontend/helpers/pagination');
describe('{{pagination}} helper', function () { describe('{{pagination}} helper', function () {
before(function (done) { before(function (done) {

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
// Stuff we are testing // Stuff we are testing
const plural = require('../../../core/frontend/helpers/plural'); const plural = require('../../../../core/frontend/helpers/plural');
describe('{{plural}} helper', function () { describe('{{plural}} helper', function () {
it('will show no-value string', function () { it('will show no-value string', function () {

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
// Stuff we are testing // Stuff we are testing
const post_class = require('../../../core/frontend/helpers/post_class'); const post_class = require('../../../../core/frontend/helpers/post_class');
describe('{{post_class}} helper', function () { describe('{{post_class}} helper', function () {
it('can render class string', function () { it('can render class string', function () {

View File

@ -1,9 +1,9 @@
const errors = require('@tryghost/errors'); const errors = require('@tryghost/errors');
const sinon = require('sinon'); const sinon = require('sinon');
const Promise = require('bluebird'); const Promise = require('bluebird');
const markdownToMobiledoc = require('../../utils/fixtures/data-generator').markdownToMobiledoc; const markdownToMobiledoc = require('../../../utils/fixtures/data-generator').markdownToMobiledoc;
const prev_post = require('../../../core/frontend/helpers/prev_post'); const prev_post = require('../../../../core/frontend/helpers/prev_post');
const api = require('../../../core/server/api'); const api = require('../../../../core/server/api');
describe('{{prev_post}} helper', function () { describe('{{prev_post}} helper', function () {
const apiVersion = 'canary'; const apiVersion = 'canary';

View File

@ -1,6 +1,6 @@
const should = require('should'); const should = require('should');
const price = require('../../../core/frontend/helpers/price'); const price = require('../../../../core/frontend/helpers/price');
const handlebars = require('../../../core/frontend/services/theme-engine/engine').handlebars; const handlebars = require('../../../../core/frontend/services/theme-engine/engine').handlebars;
function compile(templateString) { function compile(templateString) {
const template = handlebars.compile(templateString); const template = handlebars.compile(templateString);

View File

@ -1,6 +1,6 @@
const should = require('should'); const should = require('should');
const raw = require('../../../core/frontend/helpers/raw'); const raw = require('../../../../core/frontend/helpers/raw');
const handlebars = require('../../../core/frontend/services/theme-engine/engine').handlebars; const handlebars = require('../../../../core/frontend/services/theme-engine/engine').handlebars;
let defaultGlobals; let defaultGlobals;

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
// Stuff we are testing // Stuff we are testing
const reading_time = require('../../../core/frontend/helpers/reading_time'); const reading_time = require('../../../../core/frontend/helpers/reading_time');
const almostOneMinute = const almostOneMinute =
'<p>Ghost has a number of different user roles for your team</p>' + '<p>Ghost has a number of different user roles for your team</p>' +

View File

@ -1,13 +1,13 @@
const should = require('should'); const should = require('should');
const path = require('path'); const path = require('path');
const t = require('../../../core/frontend/helpers/t'); const t = require('../../../../core/frontend/helpers/t');
const themeI18n = require('../../../core/frontend/services/theme-engine/i18n'); const themeI18n = require('../../../../core/frontend/services/theme-engine/i18n');
describe('{{t}} helper', function () { describe('{{t}} helper', function () {
let ogBasePath = themeI18n.basePath; let ogBasePath = themeI18n.basePath;
before(function () { before(function () {
themeI18n.basePath = path.join(__dirname, '../../utils/fixtures/themes/'); themeI18n.basePath = path.join(__dirname, '../../../utils/fixtures/themes/');
}); });
after(function () { after(function () {

View File

@ -1,9 +1,9 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const testUtils = require('../../utils'); const testUtils = require('../../../utils');
const urlService = require('../../../core/frontend/services/url'); const urlService = require('../../../../core/frontend/services/url');
const models = require('../../../core/server/models'); const models = require('../../../../core/server/models');
const tagsHelper = require('../../../core/frontend/helpers/tags'); const tagsHelper = require('../../../../core/frontend/helpers/tags');
describe('{{tags}} helper', function () { describe('{{tags}} helper', function () {
before(function () { before(function () {

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
// Stuff we are testing // Stuff we are testing
const title = require('../../../core/frontend/helpers/title'); const title = require('../../../../core/frontend/helpers/title');
describe('{{title}} Helper', function () { describe('{{title}} Helper', function () {
it('can render title', function () { it('can render title', function () {

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
// Stuff we are testing // Stuff we are testing
const twitter_url = require('../../../core/frontend/helpers/twitter_url'); const twitter_url = require('../../../../core/frontend/helpers/twitter_url');
describe('{{twitter_url}} helper', function () { describe('{{twitter_url}} helper', function () {
const options = {data: {site: {}}}; const options = {data: {site: {}}};

View File

@ -1,13 +1,13 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const Promise = require('bluebird'); const Promise = require('bluebird');
const testUtils = require('../../utils'); const testUtils = require('../../../utils');
const configUtils = require('../../utils/configUtils'); const configUtils = require('../../../utils/configUtils');
const markdownToMobiledoc = require('../../utils/fixtures/data-generator').markdownToMobiledoc; const markdownToMobiledoc = require('../../../utils/fixtures/data-generator').markdownToMobiledoc;
const url = require('../../../core/frontend/helpers/url'); const url = require('../../../../core/frontend/helpers/url');
const urlService = require('../../../core/frontend/services/url'); const urlService = require('../../../../core/frontend/services/url');
const api = require('../../../core/server/api'); const api = require('../../../../core/server/api');
describe('{{url}} helper', function () { describe('{{url}} helper', function () {
let rendered; let rendered;

View File

@ -1,10 +1,10 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const rewire = require('rewire'); const rewire = require('rewire');
const urlUtils = require('../../../core/shared/url-utils'); const urlUtils = require('../../../../core/shared/url-utils');
const testUtils = require('../../utils'); const testUtils = require('../../../utils');
let getAmpUrl = rewire('../../../core/frontend/meta/amp-url'); let getAmpUrl = rewire('../../../../core/frontend/meta/amp-url');
describe('getAmpUrl', function () { describe('getAmpUrl', function () {
let getUrlStub; let getUrlStub;
@ -12,7 +12,7 @@ describe('getAmpUrl', function () {
beforeEach(function () { beforeEach(function () {
getUrlStub = sinon.stub(); getUrlStub = sinon.stub();
getAmpUrl = rewire('../../../core/frontend/meta/amp-url'); getAmpUrl = rewire('../../../../core/frontend/meta/amp-url');
getAmpUrl.__set__('getUrl', getUrlStub); getAmpUrl.__set__('getUrl', getUrlStub);
sinon.stub(urlUtils, 'urlJoin'); sinon.stub(urlUtils, 'urlJoin');

View File

@ -1,12 +1,12 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const rewire = require('rewire'); const rewire = require('rewire');
const imageLib = require('../../../core/server/lib/image'); const imageLib = require('../../../../core/server/lib/image');
const settingsCache = require('../../../core/shared/settings-cache'); const settingsCache = require('../../../../core/shared/settings-cache');
const configUtils = require('../../utils/configUtils'); const configUtils = require('../../../utils/configUtils');
const config = configUtils.config; const config = configUtils.config;
const getAssetUrl = rewire('../../../core/frontend/meta/asset-url'); const getAssetUrl = rewire('../../../../core/frontend/meta/asset-url');
describe('getAssetUrl', function () { describe('getAssetUrl', function () {
afterEach(function () { afterEach(function () {

View File

@ -1,5 +1,5 @@
const should = require('should'); const should = require('should');
const getAuthorFacebookUrl = require('../../../core/frontend/meta/author-fb-url'); const getAuthorFacebookUrl = require('../../../../core/frontend/meta/author-fb-url');
describe('getAuthorFacebookUrl', function () { describe('getAuthorFacebookUrl', function () {
it('should return author facebook url if post and has url', it('should return author facebook url if post and has url',

View File

@ -1,6 +1,6 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const getAuthorImage = require('../../../core/frontend/meta/author-image'); const getAuthorImage = require('../../../../core/frontend/meta/author-image');
describe('getAuthorImage', function () { describe('getAuthorImage', function () {
afterEach(function () { afterEach(function () {

View File

@ -1,8 +1,8 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const ObjectId = require('bson-objectid'); const ObjectId = require('bson-objectid');
const urlService = require('../../../core/frontend/services/url'); const urlService = require('../../../../core/frontend/services/url');
const getAuthorUrl = require('../../../core/frontend/meta/author-url'); const getAuthorUrl = require('../../../../core/frontend/meta/author-url');
describe('getAuthorUrl', function () { describe('getAuthorUrl', function () {
beforeEach(function () { beforeEach(function () {

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
const getBlogLogo = require('../../../core/frontend/meta/blog-logo'); const getBlogLogo = require('../../../../core/frontend/meta/blog-logo');
const sinon = require('sinon'); const sinon = require('sinon');
const settingsCache = require('../../../core/shared/settings-cache'); const settingsCache = require('../../../../core/shared/settings-cache');
describe('getBlogLogo', function () { describe('getBlogLogo', function () {
afterEach(function () { afterEach(function () {

View File

@ -1,10 +1,10 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const rewire = require('rewire'); const rewire = require('rewire');
const urlUtils = require('../../../core/shared/url-utils'); const urlUtils = require('../../../../core/shared/url-utils');
const testUtils = require('../../utils'); const testUtils = require('../../../utils');
let getCanonicalUrl = rewire('../../../core/frontend/meta/canonical-url'); let getCanonicalUrl = rewire('../../../../core/frontend/meta/canonical-url');
describe('getCanonicalUrl', function () { describe('getCanonicalUrl', function () {
let getUrlStub; let getUrlStub;
@ -12,7 +12,7 @@ describe('getCanonicalUrl', function () {
beforeEach(function () { beforeEach(function () {
getUrlStub = sinon.stub(); getUrlStub = sinon.stub();
getCanonicalUrl = rewire('../../../core/frontend/meta/canonical-url'); getCanonicalUrl = rewire('../../../../core/frontend/meta/canonical-url');
getCanonicalUrl.__set__('getUrl', getUrlStub); getCanonicalUrl.__set__('getUrl', getUrlStub);
sinon.stub(urlUtils, 'urlJoin'); sinon.stub(urlUtils, 'urlJoin');

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const getContextObject = require('../../../core/frontend/meta/context-object.js'); const getContextObject = require('../../../../core/frontend/meta/context-object.js');
const settingsCache = require('../../../core/shared/settings-cache'); const settingsCache = require('../../../../core/shared/settings-cache');
describe('getContextObject', function () { describe('getContextObject', function () {
let data; let data;

View File

@ -1,5 +1,5 @@
const should = require('should'); const should = require('should');
const getCoverImage = require('../../../core/frontend/meta/cover-image'); const getCoverImage = require('../../../../core/frontend/meta/cover-image');
describe('getCoverImage', function () { describe('getCoverImage', function () {
it('should return absolute cover image url for home', function () { it('should return absolute cover image url for home', function () {

View File

@ -1,5 +1,5 @@
const should = require('should'); const should = require('should');
const getCreatorTwitterUrl = require('../../../core/frontend/meta/creator-url'); const getCreatorTwitterUrl = require('../../../../core/frontend/meta/creator-url');
describe('getCreatorTwitterUrl', function () { describe('getCreatorTwitterUrl', function () {
it('should return author twitter url if post and has url', it('should return author twitter url if post and has url',

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const getMetaDescription = require('../../../core/frontend/meta/description'); const getMetaDescription = require('../../../../core/frontend/meta/description');
const settingsCache = require('../../../core/shared/settings-cache'); const settingsCache = require('../../../../core/shared/settings-cache');
describe('getMetaDescription', function () { describe('getMetaDescription', function () {
let localSettingsCache = {}; let localSettingsCache = {};

View File

@ -1,5 +1,5 @@
const should = require('should'); const should = require('should');
const generateExcerpt = require('../../../core/frontend/meta/generate-excerpt'); const generateExcerpt = require('../../../../core/frontend/meta/generate-excerpt');
describe('generateExcerpt', function () { describe('generateExcerpt', function () {
it('should return html excerpt with no html', function () { it('should return html excerpt with no html', function () {

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const rewire = require('rewire'); const rewire = require('rewire');
const getImageDimensions = rewire('../../../core/frontend/meta/image-dimensions'); const getImageDimensions = rewire('../../../../core/frontend/meta/image-dimensions');
describe('getImageDimensions', function () { describe('getImageDimensions', function () {
let sizeOfStub; let sizeOfStub;

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const models = require('../../../core/server/models'); const models = require('../../../../core/server/models');
const getKeywords = require('../../../core/frontend/meta/keywords'); const getKeywords = require('../../../../core/frontend/meta/keywords');
describe('getKeywords', function () { describe('getKeywords', function () {
before(function () { before(function () {

View File

@ -1,5 +1,5 @@
const should = require('should'); const should = require('should');
const getModifiedDate = require('../../../core/frontend/meta/modified-date'); const getModifiedDate = require('../../../../core/frontend/meta/modified-date');
describe('getModifiedDate', function () { describe('getModifiedDate', function () {
it('should return updated at date as ISO 8601 from context if exists', function () { it('should return updated at date as ISO 8601 from context if exists', function () {

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const getOgImage = require('../../../core/frontend/meta/og-image'); const getOgImage = require('../../../../core/frontend/meta/og-image');
const settingsCache = require('../../../core/shared/settings-cache'); const settingsCache = require('../../../../core/shared/settings-cache');
describe('getOgImage', function () { describe('getOgImage', function () {
let localSettingsCache = {}; let localSettingsCache = {};

View File

@ -1,5 +1,5 @@
const should = require('should'); const should = require('should');
const getOgType = require('../../../core/frontend/meta/og-type'); const getOgType = require('../../../../core/frontend/meta/og-type');
describe('getOgType', function () { describe('getOgType', function () {
it('should return og type profile if context is type author', function () { it('should return og type profile if context is type author', function () {

View File

@ -1,6 +1,6 @@
const should = require('should'); const should = require('should');
const getPaginatedUrl = require('../../../core/frontend/meta/paginated-url'); const getPaginatedUrl = require('../../../../core/frontend/meta/paginated-url');
const configUtils = require('../../utils/configUtils'); const configUtils = require('../../../utils/configUtils');
describe('getPaginatedUrl', function () { describe('getPaginatedUrl', function () {
let data; let data;

View File

@ -1,5 +1,5 @@
const should = require('should'); const should = require('should');
const getPublishedDate = require('../../../core/frontend/meta/published-date'); const getPublishedDate = require('../../../../core/frontend/meta/published-date');
describe('getPublishedDate', function () { describe('getPublishedDate', function () {
it('should return published at date as ISO 8601 from context if exists', function () { it('should return published at date as ISO 8601 from context if exists', function () {

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const routing = require('../../../core/frontend/services/routing'); const routing = require('../../../../core/frontend/services/routing');
const getRssUrl = require('../../../core/frontend/meta/rss-url'); const getRssUrl = require('../../../../core/frontend/meta/rss-url');
describe('getRssUrl', function () { describe('getRssUrl', function () {
beforeEach(function () { beforeEach(function () {

View File

@ -1,6 +1,6 @@
const should = require('should'); const should = require('should');
const getSchema = require('../../../core/frontend/meta/schema'); const getSchema = require('../../../../core/frontend/meta/schema');
const markdownToMobiledoc = require('../../utils/fixtures/data-generator').markdownToMobiledoc; const markdownToMobiledoc = require('../../../utils/fixtures/data-generator').markdownToMobiledoc;
describe('getSchema', function () { describe('getSchema', function () {
it('should return post schema if context starts with post', function (done) { it('should return post schema if context starts with post', function (done) {

View File

@ -1,5 +1,5 @@
const should = require('should'); const should = require('should');
const getStructuredData = require('../../../core/frontend/meta/structured-data'); const getStructuredData = require('../../../../core/frontend/meta/structured-data');
describe('getStructuredData', function () { describe('getStructuredData', function () {
it('should return structured data from metadata per post', function (done) { it('should return structured data from metadata per post', function (done) {

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const getTitle = require('../../../core/frontend/meta/title'); const getTitle = require('../../../../core/frontend/meta/title');
const settingsCache = require('../../../core/shared/settings-cache'); const settingsCache = require('../../../../core/shared/settings-cache');
describe('getTitle', function () { describe('getTitle', function () {
let localSettingsCache = {}; let localSettingsCache = {};

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const getTwitterImage = require('../../../core/frontend/meta/twitter-image'); const getTwitterImage = require('../../../../core/frontend/meta/twitter-image');
const settingsCache = require('../../../core/shared/settings-cache'); const settingsCache = require('../../../../core/shared/settings-cache');
describe('getTwitterImage', function () { describe('getTwitterImage', function () {
let localSettingsCache = {}; let localSettingsCache = {};

View File

@ -1,9 +1,9 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const urlUtils = require('../../../core/shared/url-utils'); const urlUtils = require('../../../../core/shared/url-utils');
const urlService = require('../../../core/frontend/services/url'); const urlService = require('../../../../core/frontend/services/url');
const getUrl = require('../../../core/frontend/meta/url'); const getUrl = require('../../../../core/frontend/meta/url');
const testUtils = require('../../utils'); const testUtils = require('../../../utils');
describe('getUrl', function () { describe('getUrl', function () {
beforeEach(function () { beforeEach(function () {

View File

@ -1,8 +1,8 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const helpers = require('../../../../core/frontend/services/helpers'); const helpers = require('../../../../../core/frontend/services/helpers');
const AppProxy = require('../../../../core/frontend/services/apps/proxy'); const AppProxy = require('../../../../../core/frontend/services/apps/proxy');
const routing = require('../../../../core/frontend/services/routing'); const routing = require('../../../../../core/frontend/services/routing');
describe('Apps', function () { describe('Apps', function () {
beforeEach(function () { beforeEach(function () {

View File

@ -1,10 +1,10 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const express = require('../../../../core/shared/express')._express; const express = require('../../../../../core/shared/express')._express;
const settingsCache = require('../../../../core/shared/settings-cache'); const settingsCache = require('../../../../../core/shared/settings-cache');
const events = require('../../../../core/server/lib/common/events'); const events = require('../../../../../core/server/lib/common/events');
const controllers = require('../../../../core/frontend/services/routing/controllers'); const controllers = require('../../../../../core/frontend/services/routing/controllers');
const CollectionRouter = require('../../../../core/frontend/services/routing/CollectionRouter'); const CollectionRouter = require('../../../../../core/frontend/services/routing/CollectionRouter');
const RESOURCE_CONFIG = {QUERY: {post: {controller: 'posts', resource: 'posts'}}}; const RESOURCE_CONFIG = {QUERY: {post: {controller: 'posts', resource: 'posts'}}};
describe('UNIT - services/routing/CollectionRouter', function () { describe('UNIT - services/routing/CollectionRouter', function () {

View File

@ -1,9 +1,9 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const configUtils = require('../../../utils/configUtils'); const configUtils = require('../../../../utils/configUtils');
const events = require('../../../../core/server/lib/common/events'); const events = require('../../../../../core/server/lib/common/events');
const urlUtils = require('../../../../core/shared/url-utils'); const urlUtils = require('../../../../../core/shared/url-utils');
const ParentRouter = require('../../../../core/frontend/services/routing/ParentRouter'); const ParentRouter = require('../../../../../core/frontend/services/routing/ParentRouter');
describe('UNIT - services/routing/ParentRouter', function () { describe('UNIT - services/routing/ParentRouter', function () {
let req; let req;

View File

@ -1,10 +1,10 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const configUtils = require('../../../utils/configUtils'); const configUtils = require('../../../../utils/configUtils');
const events = require('../../../../core/server/lib/common/events'); const events = require('../../../../../core/server/lib/common/events');
const controllers = require('../../../../core/frontend/services/routing/controllers'); const controllers = require('../../../../../core/frontend/services/routing/controllers');
const RSSRouter = require('../../../../core/frontend/services/routing/RSSRouter'); const RSSRouter = require('../../../../../core/frontend/services/routing/RSSRouter');
const urlUtils = require('../../../../core/shared/url-utils'); const urlUtils = require('../../../../../core/shared/url-utils');
describe('UNIT - services/routing/RSSRouter', function () { describe('UNIT - services/routing/RSSRouter', function () {
describe('instantiate', function () { describe('instantiate', function () {

View File

@ -1,9 +1,9 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const events = require('../../../../core/server/lib/common/events'); const events = require('../../../../../core/server/lib/common/events');
const controllers = require('../../../../core/frontend/services/routing/controllers'); const controllers = require('../../../../../core/frontend/services/routing/controllers');
const StaticRoutesRouter = require('../../../../core/frontend/services/routing/StaticRoutesRouter'); const StaticRoutesRouter = require('../../../../../core/frontend/services/routing/StaticRoutesRouter');
const configUtils = require('../../../utils/configUtils'); const configUtils = require('../../../../utils/configUtils');
describe('UNIT - services/routing/StaticRoutesRouter', function () { describe('UNIT - services/routing/StaticRoutesRouter', function () {
let req; let req;

View File

@ -1,13 +1,13 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const _ = require('lodash'); const _ = require('lodash');
const settingsCache = require('../../../../core/shared/settings-cache'); const settingsCache = require('../../../../../core/shared/settings-cache');
const events = require('../../../../core/server/lib/common/events'); const events = require('../../../../../core/server/lib/common/events');
const controllers = require('../../../../core/frontend/services/routing/controllers'); const controllers = require('../../../../../core/frontend/services/routing/controllers');
const TaxonomyRouter = require('../../../../core/frontend/services/routing/TaxonomyRouter'); const TaxonomyRouter = require('../../../../../core/frontend/services/routing/TaxonomyRouter');
const RESOURCE_CONFIG_V2 = require('../../../../core/frontend/services/routing/config/v2'); const RESOURCE_CONFIG_V2 = require('../../../../../core/frontend/services/routing/config/v2');
const RESOURCE_CONFIG_CANARY = require('../../../../core/frontend/services/routing/config/canary'); const RESOURCE_CONFIG_CANARY = require('../../../../../core/frontend/services/routing/config/canary');
const RESOURCE_CONFIG_V3 = require('../../../../core/frontend/services/routing/config/v3'); const RESOURCE_CONFIG_V3 = require('../../../../../core/frontend/services/routing/config/v3');
describe('UNIT - services/routing/TaxonomyRouter', function () { describe('UNIT - services/routing/TaxonomyRouter', function () {
let req; let req;

View File

@ -1,11 +1,11 @@
const errors = require('@tryghost/errors'); const errors = require('@tryghost/errors');
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const testUtils = require('../../../../utils'); const testUtils = require('../../../../../utils');
const security = require('@tryghost/security'); const security = require('@tryghost/security');
const themeEngine = require('../../../../../core/frontend/services/theme-engine'); const themeEngine = require('../../../../../../core/frontend/services/theme-engine');
const controllers = require('../../../../../core/frontend/services/routing/controllers'); const controllers = require('../../../../../../core/frontend/services/routing/controllers');
const helpers = require('../../../../../core/frontend/services/routing/helpers'); const helpers = require('../../../../../../core/frontend/services/routing/helpers');
function failTest(done) { function failTest(done) {
return function (err) { return function (err) {

View File

@ -1,12 +1,12 @@
const errors = require('@tryghost/errors'); const errors = require('@tryghost/errors');
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const testUtils = require('../../../../utils'); const testUtils = require('../../../../../utils');
const security = require('@tryghost/security'); const security = require('@tryghost/security');
const themeEngine = require('../../../../../core/frontend/services/theme-engine'); const themeEngine = require('../../../../../../core/frontend/services/theme-engine');
const urlService = require('../../../../../core/frontend/services/url'); const urlService = require('../../../../../../core/frontend/services/url');
const controllers = require('../../../../../core/frontend/services/routing/controllers'); const controllers = require('../../../../../../core/frontend/services/routing/controllers');
const helpers = require('../../../../../core/frontend/services/routing/helpers'); const helpers = require('../../../../../../core/frontend/services/routing/helpers');
function failTest(done) { function failTest(done) {
return function (err) { return function (err) {

View File

@ -1,11 +1,11 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const testUtils = require('../../../../utils'); const testUtils = require('../../../../../utils');
const configUtils = require('../../../../utils/configUtils'); const configUtils = require('../../../../../utils/configUtils');
const urlService = require('../../../../../core/frontend/services/url'); const urlService = require('../../../../../../core/frontend/services/url');
const urlUtils = require('../../../../../core/shared/url-utils'); const urlUtils = require('../../../../../../core/shared/url-utils');
const controllers = require('../../../../../core/frontend/services/routing/controllers'); const controllers = require('../../../../../../core/frontend/services/routing/controllers');
const helpers = require('../../../../../core/frontend/services/routing/helpers'); const helpers = require('../../../../../../core/frontend/services/routing/helpers');
const EDITOR_URL = `/#/editor/post/`; const EDITOR_URL = `/#/editor/post/`;
describe('Unit - services/routing/controllers/entry', function () { describe('Unit - services/routing/controllers/entry', function () {

View File

@ -1,13 +1,13 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const Promise = require('bluebird'); const Promise = require('bluebird');
const testUtils = require('../../../../utils'); const testUtils = require('../../../../../utils');
const configUtils = require('../../../../utils/configUtils'); const configUtils = require('../../../../../utils/configUtils');
const api = require('../../../../../core/server/api'); const api = require('../../../../../../core/server/api');
const controllers = require('../../../../../core/frontend/services/routing/controllers'); const controllers = require('../../../../../../core/frontend/services/routing/controllers');
const helpers = require('../../../../../core/frontend/services/routing/helpers'); const helpers = require('../../../../../../core/frontend/services/routing/helpers');
const urlService = require('../../../../../core/frontend/services/url'); const urlService = require('../../../../../../core/frontend/services/url');
const urlUtils = require('../../../../../core/shared/url-utils'); const urlUtils = require('../../../../../../core/shared/url-utils');
const EDITOR_URL = '/#/editor/post/'; const EDITOR_URL = '/#/editor/post/';
describe('Unit - services/routing/controllers/preview', function () { describe('Unit - services/routing/controllers/preview', function () {

View File

@ -1,10 +1,10 @@
const sinon = require('sinon'); const sinon = require('sinon');
const testUtils = require('../../../../utils'); const testUtils = require('../../../../../utils');
const security = require('@tryghost/security'); const security = require('@tryghost/security');
const settingsCache = require('../../../../../core/shared/settings-cache'); const settingsCache = require('../../../../../../core/shared/settings-cache');
const controllers = require('../../../../../core/frontend/services/routing/controllers'); const controllers = require('../../../../../../core/frontend/services/routing/controllers');
const helpers = require('../../../../../core/frontend/services/routing/helpers'); const helpers = require('../../../../../../core/frontend/services/routing/helpers');
const rssService = require('../../../../../core/frontend/services/rss'); const rssService = require('../../../../../../core/frontend/services/rss');
// Helper function to prevent unit tests // Helper function to prevent unit tests
// from failing via timeout when they // from failing via timeout when they

View File

@ -1,10 +1,10 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const testUtils = require('../../../../utils'); const testUtils = require('../../../../../utils');
const api = require('../../../../../core/server/api'); const api = require('../../../../../../core/server/api');
const themeEngine = require('../../../../../core/frontend/services/theme-engine'); const themeEngine = require('../../../../../../core/frontend/services/theme-engine');
const helpers = require('../../../../../core/frontend/services/routing/helpers'); const helpers = require('../../../../../../core/frontend/services/routing/helpers');
const controllers = require('../../../../../core/frontend/services/routing/controllers'); const controllers = require('../../../../../../core/frontend/services/routing/controllers');
function failTest(done) { function failTest(done) {
return function (err) { return function (err) {

View File

@ -1,9 +1,9 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const _ = require('lodash'); const _ = require('lodash');
const testUtils = require('../../../../utils'); const testUtils = require('../../../../../utils');
const helpers = require('../../../../../core/frontend/services/routing/helpers'); const helpers = require('../../../../../../core/frontend/services/routing/helpers');
const labs = require('../../../../../core/shared/labs'); const labs = require('../../../../../../core/shared/labs');
describe('Contexts', function () { describe('Contexts', function () {
let req; let req;

View File

@ -1,9 +1,9 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const Promise = require('bluebird'); const Promise = require('bluebird');
const testUtils = require('../../../../utils'); const testUtils = require('../../../../../utils');
const api = require('../../../../../core/server/api'); const api = require('../../../../../../core/server/api');
const helpers = require('../../../../../core/frontend/services/routing/helpers'); const helpers = require('../../../../../../core/frontend/services/routing/helpers');
describe('Unit - services/routing/helpers/entry-lookup', function () { describe('Unit - services/routing/helpers/entry-lookup', function () {
let locals; let locals;

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const errors = require('@tryghost/errors'); const errors = require('@tryghost/errors');
const helpers = require('../../../../../core/frontend/services/routing/helpers'); const helpers = require('../../../../../../core/frontend/services/routing/helpers');
describe('handleError', function () { describe('handleError', function () {
let next; let next;

View File

@ -1,8 +1,8 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const api = require('../../../../../core/server/api').v2; const api = require('../../../../../../core/server/api').v2;
const helpers = require('../../../../../core/frontend/services/routing/helpers'); const helpers = require('../../../../../../core/frontend/services/routing/helpers');
const testUtils = require('../../../../utils'); const testUtils = require('../../../../../utils');
describe('Unit - services/routing/helpers/fetch-data', function () { describe('Unit - services/routing/helpers/fetch-data', function () {
let posts; let posts;

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
const testUtils = require('../../../../utils'); const testUtils = require('../../../../../utils');
const helpers = require('../../../../../core/frontend/services/routing/helpers'); const helpers = require('../../../../../../core/frontend/services/routing/helpers');
const {SafeString} = require('../../../../../core/frontend/services/rendering'); const {SafeString} = require('../../../../../../core/frontend/services/rendering');
describe('Unit - services/routing/helpers/format-response', function () { describe('Unit - services/routing/helpers/format-response', function () {
let posts; let posts;

View File

@ -1,8 +1,8 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const rewire = require('rewire'); const rewire = require('rewire');
const templates = rewire('../../../../../core/frontend/services/routing/helpers/templates'); const templates = rewire('../../../../../../core/frontend/services/routing/helpers/templates');
const themeEngine = require('../../../../../core/frontend/services/theme-engine'); const themeEngine = require('../../../../../../core/frontend/services/theme-engine');
describe('templates', function () { describe('templates', function () {
let getActiveThemeStub; let getActiveThemeStub;

View File

@ -1,8 +1,8 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const errors = require('@tryghost/errors'); const errors = require('@tryghost/errors');
const urlUtils = require('../../../../../core/shared/url-utils'); const urlUtils = require('../../../../../../core/shared/url-utils');
const middlewares = require('../../../../../core/frontend/services/routing/middlewares'); const middlewares = require('../../../../../../core/frontend/services/routing/middlewares');
describe('UNIT: services/routing/middlewares/page-param', function () { describe('UNIT: services/routing/middlewares/page-param', function () {
let req; let req;

View File

@ -1,7 +1,7 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const rewire = require('rewire'); const rewire = require('rewire');
const registry = rewire('../../../../core/frontend/services/routing/registry'); const registry = rewire('../../../../../core/frontend/services/routing/registry');
describe('UNIT: services/routing/registry', function () { describe('UNIT: services/routing/registry', function () {
let getRssUrlStub; let getRssUrlStub;

View File

@ -1,8 +1,8 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const rewire = require('rewire'); const rewire = require('rewire');
const configUtils = require('../../../utils/configUtils'); const configUtils = require('../../../../utils/configUtils');
const rssCache = rewire('../../../../core/frontend/services/rss/cache'); const rssCache = rewire('../../../../../core/frontend/services/rss/cache');
describe('RSS: Cache', function () { describe('RSS: Cache', function () {
let generateSpy; let generateSpy;

View File

@ -1,10 +1,10 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const _ = require('lodash'); const _ = require('lodash');
const testUtils = require('../../../utils'); const testUtils = require('../../../../utils');
const configUtils = require('../../../utils/configUtils'); const configUtils = require('../../../../utils/configUtils');
const urlService = require('../../../../core/frontend/services/url'); const urlService = require('../../../../../core/frontend/services/url');
const generateFeed = require('../../../../core/frontend/services/rss/generate-feed'); const generateFeed = require('../../../../../core/frontend/services/rss/generate-feed');
describe('RSS: Generate Feed', function () { describe('RSS: Generate Feed', function () {
const data = {}; const data = {};

View File

@ -1,8 +1,8 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const Promise = require('bluebird'); const Promise = require('bluebird');
const rssCache = require('../../../../core/frontend/services/rss/cache'); const rssCache = require('../../../../../core/frontend/services/rss/cache');
const renderer = require('../../../../core/frontend/services/rss/renderer'); const renderer = require('../../../../../core/frontend/services/rss/renderer');
describe('RSS: Renderer', function () { describe('RSS: Renderer', function () {
let rssCacheStub; let rssCacheStub;

View File

@ -2,13 +2,13 @@ const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const ObjectId = require('bson-objectid'); const ObjectId = require('bson-objectid');
const _ = require('lodash'); const _ = require('lodash');
const testUtils = require('../../../utils'); const testUtils = require('../../../../utils');
const urlUtils = require('../../../../core/shared/url-utils'); const urlUtils = require('../../../../../core/shared/url-utils');
const IndexGenerator = require('../../../../core/frontend/services/sitemap/index-generator'); const IndexGenerator = require('../../../../../core/frontend/services/sitemap/index-generator');
const PostGenerator = require('../../../../core/frontend/services/sitemap/post-generator'); const PostGenerator = require('../../../../../core/frontend/services/sitemap/post-generator');
const PageGenerator = require('../../../../core/frontend/services/sitemap/page-generator'); const PageGenerator = require('../../../../../core/frontend/services/sitemap/page-generator');
const TagGenerator = require('../../../../core/frontend/services/sitemap/tag-generator'); const TagGenerator = require('../../../../../core/frontend/services/sitemap/tag-generator');
const UserGenerator = require('../../../../core/frontend/services/sitemap/user-generator'); const UserGenerator = require('../../../../../core/frontend/services/sitemap/user-generator');
should.Assertion.add('ValidUrlNode', function (options) { should.Assertion.add('ValidUrlNode', function (options) {
// Check urlNode looks correct // Check urlNode looks correct

View File

@ -2,14 +2,14 @@ const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
// Stuff we are testing // Stuff we are testing
const events = require('../../../../core/server/lib/common/events'); const events = require('../../../../../core/server/lib/common/events');
const SiteMapManager = require('../../../../core/frontend/services/sitemap/manager'); const SiteMapManager = require('../../../../../core/frontend/services/sitemap/manager');
const PostGenerator = require('../../../../core/frontend/services/sitemap/post-generator'); const PostGenerator = require('../../../../../core/frontend/services/sitemap/post-generator');
const PageGenerator = require('../../../../core/frontend/services/sitemap/page-generator'); const PageGenerator = require('../../../../../core/frontend/services/sitemap/page-generator');
const TagGenerator = require('../../../../core/frontend/services/sitemap/tag-generator'); const TagGenerator = require('../../../../../core/frontend/services/sitemap/tag-generator');
const UserGenerator = require('../../../../core/frontend/services/sitemap/user-generator'); const UserGenerator = require('../../../../../core/frontend/services/sitemap/user-generator');
const IndexGenerator = require('../../../../core/frontend/services/sitemap/index-generator'); const IndexGenerator = require('../../../../../core/frontend/services/sitemap/index-generator');
describe('Unit: sitemap/manager', function () { describe('Unit: sitemap/manager', function () {
let eventsToRemember; let eventsToRemember;

View File

@ -1,10 +1,10 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const config = require('../../../../core/shared/config'); const config = require('../../../../../core/shared/config');
// is only exposed via themeEngine.getActive() // is only exposed via themeEngine.getActive()
const activeTheme = require('../../../../core/frontend/services/theme-engine/active'); const activeTheme = require('../../../../../core/frontend/services/theme-engine/active');
const engine = require('../../../../core/frontend/services/theme-engine/engine'); const engine = require('../../../../../core/frontend/services/theme-engine/engine');
describe('Themes', function () { describe('Themes', function () {
afterEach(function () { afterEach(function () {

View File

@ -1,6 +1,6 @@
const should = require('should'); const should = require('should');
const sinon = require('sinon'); const sinon = require('sinon');
const themeConfig = require('../../../../core/frontend/services/theme-engine/config'); const themeConfig = require('../../../../../core/frontend/services/theme-engine/config');
describe('Themes', function () { describe('Themes', function () {
afterEach(function () { afterEach(function () {

Some files were not shown because too many files have changed in this diff Show More