diff --git a/lib/routes/admin-api/applications.js b/lib/routes/admin-api/applications.js deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/lib/routes/admin-api/applications.test.js b/lib/routes/admin-api/applications.test.js deleted file mode 100644 index 0f88c2a04b..0000000000 --- a/lib/routes/admin-api/applications.test.js +++ /dev/null @@ -1,34 +0,0 @@ -'use strict'; - -const { test } = require('ava'); -const store = require('./../../../test/fixtures/store'); -const supertest = require('supertest'); -const getApp = require('../../app'); - -const { EventEmitter } = require('events'); -const eventBus = new EventEmitter(); - -function getSetup() { - const stores = store.createStores(); - const app = getApp({ - baseUriPath: '', - stores, - eventBus, - }); - - return { - request: supertest(app), - stores, - }; -} - -test('should return list of client applications', t => { - t.plan(1); - const { request } = getSetup(); - return request - .get('/api/admin/metrics/applications') - .expect(200) - .expect(res => { - t.true(res.body.applications.length === 0); - }); -}); diff --git a/lib/routes/admin-api/metrics.test.js b/lib/routes/admin-api/metrics.test.js index 6d60600284..f8e0aadb79 100644 --- a/lib/routes/admin-api/metrics.test.js +++ b/lib/routes/admin-api/metrics.test.js @@ -94,6 +94,18 @@ test('should return metrics for all toggles', t => { }); }); +test('should return empty list of client applications', t => { + t.plan(1); + const { request } = getSetup(); + + return request + .get('/api/admin/metrics/applications') + .expect(200) + .expect(res => { + t.true(res.body.applications.length === 0); + }); +}); + test('should return applications', t => { t.plan(2); const { request, stores } = getSetup(); diff --git a/test/fixtures/fake-client-applications-store.js b/test/fixtures/fake-client-applications-store.js index 2f4f7b0921..4921c07d00 100644 --- a/test/fixtures/fake-client-applications-store.js +++ b/test/fixtures/fake-client-applications-store.js @@ -1,12 +1,14 @@ 'use strict'; -const _appliations = []; +module.exports = () => { + const apps = []; -module.exports = () => ({ - upsert: app => { - _appliations.push(app); - return Promise.resolve(); - }, - getApplications: () => Promise.resolve(_appliations), - getApplication: appName => _appliations.filter(a => a.name === appName)[0], -}); + return { + upsert: app => { + apps.push(app); + return Promise.resolve(); + }, + getApplications: () => Promise.resolve(apps), + getApplication: appName => apps.filter(a => a.name === appName)[0], + }; +};