diff --git a/services/web/app/src/Features/Analytics/AnalyticsController.js b/services/web/app/src/Features/Analytics/AnalyticsController.js index c0ce26ca06..e4b6140ced 100644 --- a/services/web/app/src/Features/Analytics/AnalyticsController.js +++ b/services/web/app/src/Features/Analytics/AnalyticsController.js @@ -1,7 +1,6 @@ const metrics = require('@overleaf/metrics') const AnalyticsManager = require('./AnalyticsManager') const AuthenticationController = require('../Authentication/AuthenticationController') -const InstitutionsAPI = require('../Institutions/InstitutionsAPI') const GeoIpLookup = require('../../infrastructure/GeoIpLookup') const Features = require('../../infrastructure/Features') @@ -35,35 +34,5 @@ module.exports = { AuthenticationController.getLoggedInUserId(req) || req.sessionID AnalyticsManager.recordEvent(userId, req.params.event, req.body) res.sendStatus(202) - }, - - licences(req, res, next) { - InstitutionsAPI.getInstitutionLicences( - req.query.resource_id, - req.query.start_date, - req.query.end_date, - req.query.lag, - function (error, licences) { - if (error) { - return next(error) - } - res.send(licences) - } - ) - }, - - newLicences(req, res, next) { - InstitutionsAPI.getInstitutionNewLicences( - req.query.resource_id, - req.query.start_date, - req.query.end_date, - req.query.lag, - function (error, licences) { - if (error) { - return next(error) - } - res.send(licences) - } - ) } } diff --git a/services/web/test/unit/src/Analytics/AnalyticsControllerTests.js b/services/web/test/unit/src/Analytics/AnalyticsControllerTests.js index a52440be9e..ae99971bbc 100644 --- a/services/web/test/unit/src/Analytics/AnalyticsControllerTests.js +++ b/services/web/test/unit/src/Analytics/AnalyticsControllerTests.js @@ -15,10 +15,6 @@ describe('AnalyticsController', function () { recordEvent: sinon.stub() } - this.InstitutionsAPI = { - getInstitutionLicences: sinon.stub().callsArgWith(4) - } - this.Features = { hasFeature: sinon.stub().returns(true) } @@ -28,7 +24,6 @@ describe('AnalyticsController', function () { './AnalyticsManager': this.AnalyticsManager, '../Authentication/AuthenticationController': this .AuthenticationController, - '../Institutions/InstitutionsAPI': this.InstitutionsAPI, '../../infrastructure/Features': this.Features, '../../infrastructure/GeoIpLookup': (this.GeoIpLookup = { getDetails: sinon.stub() @@ -94,32 +89,4 @@ describe('AnalyticsController', function () { done() }) }) - - describe('licences', function () { - beforeEach(function () { - this.req = { - query: { - resource_id: 1, - start_date: '1514764800', - end_date: '1530662400', - resource_type: 'institution' - }, - sessionID: 'sessionIDHere', - session: {} - } - }) - - it('should trigger institutions api to fetch licences graph data', function (done) { - this.controller.licences(this.req, this.res) - this.InstitutionsAPI.getInstitutionLicences - .calledWith( - this.req.query.resource_id, - this.req.query.start_date, - this.req.query.end_date, - this.req.query.lag - ) - .should.equal(true) - done() - }) - }) })