From 3bca65d8688140d44610f16e86091f2ddcc99531 Mon Sep 17 00:00:00 2001 From: Naz Date: Thu, 14 Oct 2021 14:00:22 +0200 Subject: [PATCH] Removed unnecessary checks in unit test suites refs https://linear.app/tryghost/issue/CORE-104/decouple-frontend-routing-events-from-urlserver-events - These modules have nothing to do with "events"! There's no reason to test for something that would not ever happen --- .../frontend/services/routing/ParentRouter.test.js | 4 ---- test/unit/frontend/services/routing/RSSRouter.test.js | 10 ---------- 2 files changed, 14 deletions(-) diff --git a/test/unit/frontend/services/routing/ParentRouter.test.js b/test/unit/frontend/services/routing/ParentRouter.test.js index 9f3a9fc6d8..48f7c1c833 100644 --- a/test/unit/frontend/services/routing/ParentRouter.test.js +++ b/test/unit/frontend/services/routing/ParentRouter.test.js @@ -1,7 +1,6 @@ const should = require('should'); const sinon = require('sinon'); const configUtils = require('../../../../utils/configUtils'); -const events = require('../../../../../core/server/lib/common/events'); const urlUtils = require('../../../../../core/shared/url-utils'); const ParentRouter = require('../../../../../core/frontend/services/routing/ParentRouter'); @@ -11,9 +10,6 @@ describe('UNIT - services/routing/ParentRouter', function () { let next; beforeEach(function () { - sinon.stub(events, 'emit'); - sinon.stub(events, 'on'); - sinon.stub(urlUtils, 'redirect301'); req = sinon.stub(); diff --git a/test/unit/frontend/services/routing/RSSRouter.test.js b/test/unit/frontend/services/routing/RSSRouter.test.js index b81341fa69..e878bff106 100644 --- a/test/unit/frontend/services/routing/RSSRouter.test.js +++ b/test/unit/frontend/services/routing/RSSRouter.test.js @@ -1,7 +1,6 @@ const should = require('should'); const sinon = require('sinon'); const configUtils = require('../../../../utils/configUtils'); -const events = require('../../../../../core/server/lib/common/events'); const controllers = require('../../../../../core/frontend/services/routing/controllers'); const RSSRouter = require('../../../../../core/frontend/services/routing/RSSRouter'); const urlUtils = require('../../../../../core/shared/url-utils'); @@ -9,9 +8,6 @@ const urlUtils = require('../../../../../core/shared/url-utils'); describe('UNIT - services/routing/RSSRouter', function () { describe('instantiate', function () { beforeEach(function () { - sinon.stub(events, 'emit'); - sinon.stub(events, 'on'); - sinon.spy(RSSRouter.prototype, 'mountRoute'); sinon.spy(RSSRouter.prototype, 'mountRouter'); @@ -29,9 +25,6 @@ describe('UNIT - services/routing/RSSRouter', function () { should.exist(rssRouter.router); rssRouter.route.value.should.eql('/rss/'); - events.emit.calledOnce.should.be.false(); - events.on.calledOnce.should.be.false(); - rssRouter.mountRoute.callCount.should.eql(2); rssRouter.mountRoute.args[0][0].should.eql('/rss/'); @@ -47,9 +40,6 @@ describe('UNIT - services/routing/RSSRouter', function () { should.exist(rssRouter.router); rssRouter.route.value.should.eql('/rss/'); - events.emit.calledOnce.should.be.false(); - events.on.calledOnce.should.be.false(); - rssRouter.mountRoute.callCount.should.eql(2); rssRouter.mountRoute.args[0][0].should.eql('/rss/');