2022-03-31 17:01:11 +03:00
|
|
|
const {agentProvider, fixtureManager, matchers} = require('../../utils/e2e-framework');
|
2022-04-27 16:53:32 +03:00
|
|
|
const {anyEtag, anyISODate, anyObjectId} = matchers;
|
2022-03-31 17:01:11 +03:00
|
|
|
|
|
|
|
let agent;
|
|
|
|
|
|
|
|
describe('Stats API', function () {
|
|
|
|
before(async function () {
|
|
|
|
agent = await agentProvider.getAdminAPIAgent();
|
|
|
|
await fixtureManager.init('members');
|
|
|
|
await agent.loginAsOwner();
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Can fetch member count history', async function () {
|
|
|
|
await agent
|
2022-03-31 18:09:28 +03:00
|
|
|
.get(`/stats/member_count`)
|
2022-03-31 17:01:11 +03:00
|
|
|
.expectStatus(200)
|
|
|
|
.matchBodySnapshot({
|
|
|
|
stats: [{
|
|
|
|
date: anyISODate
|
|
|
|
}]
|
|
|
|
})
|
|
|
|
.matchHeaderSnapshot({
|
|
|
|
etag: anyEtag
|
|
|
|
});
|
|
|
|
});
|
2022-04-08 10:18:04 +03:00
|
|
|
|
|
|
|
it('Can fetch MRR history', async function () {
|
|
|
|
await agent
|
|
|
|
.get(`/stats/mrr`)
|
|
|
|
.expectStatus(200)
|
|
|
|
.matchBodySnapshot({
|
|
|
|
stats: [{
|
|
|
|
date: anyISODate
|
2022-04-27 16:53:32 +03:00
|
|
|
}, {
|
|
|
|
date: anyISODate
|
2022-04-08 10:18:04 +03:00
|
|
|
}]
|
|
|
|
})
|
|
|
|
.matchHeaderSnapshot({
|
|
|
|
etag: anyEtag
|
|
|
|
});
|
|
|
|
});
|
2022-04-27 16:53:32 +03:00
|
|
|
|
|
|
|
it('Can fetch subscriptions history', async function () {
|
|
|
|
await agent
|
|
|
|
.get(`/stats/subscriptions`)
|
|
|
|
.expectStatus(200)
|
|
|
|
.matchBodySnapshot({
|
|
|
|
stats: [{
|
|
|
|
date: anyISODate,
|
|
|
|
tier: anyObjectId
|
|
|
|
}, {
|
|
|
|
date: anyISODate,
|
|
|
|
tier: anyObjectId
|
|
|
|
}],
|
|
|
|
meta: {
|
|
|
|
tiers: [anyObjectId],
|
|
|
|
totals: [{
|
|
|
|
tier: anyObjectId
|
|
|
|
}]
|
|
|
|
}
|
|
|
|
})
|
|
|
|
.matchHeaderSnapshot({
|
|
|
|
etag: anyEtag
|
|
|
|
});
|
|
|
|
});
|
2022-03-31 17:01:11 +03:00
|
|
|
});
|