mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Added new Tier e2e test
refs https://github.com/TryGhost/Team/issues/1446 - Added a test for successfully creating a new tier.
This commit is contained in:
parent
97830ac79a
commit
ab01e4fcbf
2 changed files with 47 additions and 0 deletions
|
@ -48,6 +48,30 @@ Object {
|
|||
}
|
||||
`;
|
||||
|
||||
exports[`Tiers API Can create a new tier 1: [body] 1`] = `
|
||||
Object {
|
||||
"tiers": Array [
|
||||
Object {
|
||||
"active": true,
|
||||
"benefits": Array [],
|
||||
"created_at": StringMatching /\\\\d\\{4\\}-\\\\d\\{2\\}-\\\\d\\{2\\}/,
|
||||
"currency": "USD",
|
||||
"description": null,
|
||||
"id": StringMatching /\\[a-f0-9\\]\\{24\\}/,
|
||||
"monthly_price": 100,
|
||||
"name": "new premium tier",
|
||||
"slug": "new-premium-tier",
|
||||
"trial_days": 0,
|
||||
"type": "paid",
|
||||
"updated_at": null,
|
||||
"visibility": "public",
|
||||
"welcome_page_url": null,
|
||||
"yearly_price": 5000,
|
||||
},
|
||||
],
|
||||
}
|
||||
`;
|
||||
|
||||
exports[`Tiers API Can edit tier properties and relations 1: [body] 1`] = `
|
||||
Object {
|
||||
"meta": Object {
|
||||
|
|
|
@ -166,4 +166,27 @@ describe('Tiers API', function () {
|
|||
})
|
||||
});
|
||||
});
|
||||
|
||||
it('Can create a new tier', async function () {
|
||||
const tier = {
|
||||
name: 'new premium tier',
|
||||
monthly_price: 100,
|
||||
currency: 'usd'
|
||||
};
|
||||
|
||||
await agent
|
||||
.post('/tiers/')
|
||||
.body({tiers: [tier]})
|
||||
.expectStatus(201)
|
||||
.matchBodySnapshot({
|
||||
tiers: Array(1).fill({
|
||||
id: matchers.anyObjectId,
|
||||
created_at: matchers.anyISODate,
|
||||
name: 'new premium tier',
|
||||
slug: 'new-premium-tier',
|
||||
monthly_price: 100,
|
||||
currency: 'USD'
|
||||
})
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue