0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Removed unnecessary use of rewire

refs: https://github.com/TryGhost/Ghost/commit/e68cb8b31

- I found that some of the places we use rewire are totally unnecessary
- Rewire seems to mess with coverage sometimes
- It's also a code smell in general so I've ripped it out where possible
This commit is contained in:
Hannah Wolfe 2022-03-24 19:32:06 +00:00
parent 45de9b0efc
commit a31069d49d
No known key found for this signature in database
GPG key ID: AB586C3B5AE5C037
5 changed files with 4 additions and 9 deletions

View file

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

View file

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

View file

@ -1,10 +1,9 @@
const should = require('should');
const sinon = require('sinon');
const rewire = require('rewire');
const Promise = require('bluebird');
const errors = require('@tryghost/errors');
const db = require('../../../../../core/server/data/db');
const exporter = rewire('../../../../../core/server/data/exporter');
const exporter = require('../../../../../core/server/data/exporter');
const schema = require('../../../../../core/server/data/schema');
const models = require('../../../../../core/server/models');
const schemaTables = Object.keys(schema.tables);

View file

@ -1,8 +1,7 @@
const sinon = require('sinon');
const should = require('should');
const rewire = require('rewire');
const nock = require('nock');
const externalRequest = rewire('../../../../core/server/lib/request-external');
const externalRequest = require('../../../../core/server/lib/request-external');
const configUtils = require('../../../utils/configUtils');
// for sinon stubs

View file

@ -1,4 +1,3 @@
const rewire = require('rewire');
const should = require('should');
const sinon = require('sinon');
const _ = require('lodash');