Skip to content

Commit

Permalink
Added test for analytics of zero projects (#941)
Browse files Browse the repository at this point in the history
  • Loading branch information
ktuite authored Aug 1, 2023
1 parent f7a11f0 commit 6d53188
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/integration/api/analytics.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
const { testService } = require('../setup');
const { sql } = require('slonik');

describe('api: /analytics/preview', () => {
describe('GET', () => {
Expand All @@ -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);
}));
}));
});
});

0 comments on commit 6d53188

Please sign in to comment.