diff --git a/test/integration/api/analytics.js b/test/integration/api/analytics.js index f2b77abbc..725cf2417 100644 --- a/test/integration/api/analytics.js +++ b/test/integration/api/analytics.js @@ -1,4 +1,5 @@ const { testService } = require('../setup'); +const { sql } = require('slonik'); describe('api: /analytics/preview', () => { describe('GET', () => { @@ -14,6 +15,19 @@ describe('api: /analytics/preview', () => { body.system.num_admins.recent.should.equal(1); body.projects.length.should.equal(1); })))); + + it('should return valid response with empty projects for fresh install ', testService(async (service, container) => { + // A fresh install of central has no projects -- delete test fixture forms and projects + await container.run(sql`delete from forms`); + await container.run(sql`delete from projects`); + + await service.login('alice', (asAlice) => + asAlice.get('/v1/analytics/preview').expect(200) + .then(({ body }) => { + body.system.num_admins.recent.should.equal(1); + body.projects.length.should.equal(0); + })); + })); }); });