Used themeService as var name everywhere [again]

refs 08fbcf1d90

- I didn't quite finish this commit before, and also forgot to write a proper commit message 🙈
- Having the theme service required and referenced in lots of different ways contributes to it being very hard to refactor and break down into smaller pieces
- This is just one simple nice-to-have so we can search the codebase for references more easily
This commit is contained in:
Hannah Wolfe 2021-04-20 15:34:51 +01:00
parent 307e035796
commit db79176724
7 changed files with 17 additions and 17 deletions

View File

@ -2,7 +2,7 @@ const should = require('should');
const sinon = require('sinon');
const path = require('path');
const configUtils = require('../../../utils/configUtils');
const themes = require('../../../../core/frontend/services/themes');
const themeService = require('../../../../core/frontend/services/themes');
const privateController = require('../../../../core/frontend/apps/private-blogging/lib/router');
describe('Private Controller', function () {
@ -24,7 +24,7 @@ describe('Private Controller', function () {
hasTemplateStub = sinon.stub().returns(false);
hasTemplateStub.withArgs('index').returns(true);
sinon.stub(themes, 'getActive').returns({
sinon.stub(themeService, 'getActive').returns({
hasTemplate: hasTemplateStub
});

View File

@ -7,7 +7,7 @@ const moment = require('moment');
const testUtils = require('../../utils');
const testUrlUtils = require('../../utils/urlUtils');
const configUtils = require('../../utils/configUtils');
const themes = require('../../../core/frontend/services/themes');
const themeService = require('../../../core/frontend/services/themes');
const models = require('../../../core/server/models');
const imageLib = require('../../../core/server/lib/image');
const routing = require('../../../core/frontend/services/routing');
@ -287,7 +287,7 @@ describe('{{ghost_head}} helper', function () {
// @TODO: this is a LOT of mocking :/
sinon.stub(routing.registry, 'getRssUrl').returns('http://localhost:65530/rss/');
sinon.stub(imageLib.imageSize, 'getImageSizeFromUrl').resolves();
sinon.stub(themes, 'getActive').returns({
sinon.stub(themeService, 'getActive').returns({
engine: () => 'v2'
});

View File

@ -2,7 +2,7 @@ const should = require('should');
const sinon = require('sinon');
const rewire = require('rewire');
const templates = rewire('../../../../../core/frontend/services/routing/helpers/templates');
const themes = require('../../../../../core/frontend/services/themes');
const themeService = require('../../../../../core/frontend/services/themes');
describe('templates', function () {
let getActiveThemeStub;
@ -76,7 +76,7 @@ describe('templates', function () {
beforeEach(function () {
hasTemplateStub = sinon.stub().returns(false);
getActiveThemeStub = sinon.stub(themes, 'getActive').returns({
getActiveThemeStub = sinon.stub(themeService, 'getActive').returns({
hasTemplate: hasTemplateStub
});
});
@ -122,7 +122,7 @@ describe('templates', function () {
beforeEach(function () {
hasTemplateStub = sinon.stub().returns(false);
getActiveThemeStub = sinon.stub(themes, 'getActive').returns({
getActiveThemeStub = sinon.stub(themeService, 'getActive').returns({
hasTemplate: hasTemplateStub
});
});
@ -258,7 +258,7 @@ describe('templates', function () {
beforeEach(function () {
hasTemplateStub = sinon.stub().returns(false);
getActiveThemeStub = sinon.stub(themes, 'getActive').returns({
getActiveThemeStub = sinon.stub(themeService, 'getActive').returns({
hasTemplate: hasTemplateStub
});
});
@ -308,7 +308,7 @@ describe('templates', function () {
beforeEach(function () {
hasTemplateStub = sinon.stub().returns(false);
getActiveThemeStub = sinon.stub(themes, 'getActive').returns({
getActiveThemeStub = sinon.stub(themeService, 'getActive').returns({
hasTemplate: hasTemplateStub
});
});

View File

@ -2,7 +2,7 @@ const should = require('should');
const sinon = require('sinon');
const config = require('../../../../core/shared/config');
// is only exposed via themes.getActive()
// is only exposed via themeService.getActive()
const activeTheme = require('../../../../core/frontend/services/themes/active');
const engine = require('../../../../core/frontend/services/theme-engine/engine');

View File

@ -1,11 +1,11 @@
const should = require('should');
const sinon = require('sinon');
const hbs = require('../../../../core/frontend/services/theme-engine/engine');
const themes = require('../../../../core/frontend/services/themes');
// is only exposed via themes.getActive()
const themeService = require('../../../../core/frontend/services/themes');
// is only exposed via themeService.getActive()
const activeTheme = require('../../../../core/frontend/services/themes/active');
const settingsCache = require('../../../../core/server/services/settings/cache');
const middleware = themes.middleware;
const middleware = themeService.middleware;
const sandbox = sinon.createSandbox();

View File

@ -2,7 +2,7 @@ const should = require('should');
const sinon = require('sinon');
const express = require('../../../../../core/shared/express');
const themeUtils = require('../../../../../core/frontend/services/themes');
const themeService = require('../../../../../core/frontend/services/themes');
const staticTheme = require('../../../../../core/server/web/site/middleware/static-theme');
describe('staticTheme', function () {
@ -15,7 +15,7 @@ describe('staticTheme', function () {
req = {};
res = {};
activeThemeStub = sinon.stub(themeUtils, 'getActive').returns({
activeThemeStub = sinon.stub(themeService, 'getActive').returns({
path: 'my/fake/path'
});

View File

@ -7,7 +7,7 @@ const routingService = require('../../core/frontend/services/routing');
const settingsService = require('../../core/server/services/settings');
const settingsCache = require('../../core/server/services/settings/cache');
const imageLib = require('../../core/server/lib/image');
const themeServices = require('../../core/frontend/services/themes');
const themeService = require('../../core/frontend/services/themes');
// Other Test Utilities
const configUtils = require('./configUtils');
@ -46,7 +46,7 @@ module.exports = {
return settingsService.init()
.then(() => {
return themeServices.init();
return themeService.init();
});
},