mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-29 07:09:48 +03:00
3d989eba23
refs https://github.com/TryGhost/Toolbox/issues/354 - this commit turns the Ghost repo into a monorepo so we can bring our internal packages back in, which makes life easier when working on Ghost
67 lines
1.8 KiB
JavaScript
67 lines
1.8 KiB
JavaScript
const {agentProvider, fixtureManager, matchers} = require('../../utils/e2e-framework');
|
|
const {anyEtag, anyISODate, anyObjectId} = matchers;
|
|
|
|
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
|
|
.get(`/stats/member_count`)
|
|
.expectStatus(200)
|
|
.matchBodySnapshot({
|
|
stats: [{
|
|
date: anyISODate
|
|
}]
|
|
})
|
|
.matchHeaderSnapshot({
|
|
etag: anyEtag
|
|
});
|
|
});
|
|
|
|
it('Can fetch MRR history', async function () {
|
|
await agent
|
|
.get(`/stats/mrr`)
|
|
.expectStatus(200)
|
|
.matchBodySnapshot({
|
|
stats: [{
|
|
date: anyISODate
|
|
}, {
|
|
date: anyISODate
|
|
}]
|
|
})
|
|
.matchHeaderSnapshot({
|
|
etag: anyEtag
|
|
});
|
|
});
|
|
|
|
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
|
|
});
|
|
});
|
|
});
|