mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
🐛 Fixed Tier description not being set (#15741)
closes https://github.com/TryGhost/Ghost/issues/15740 The validation function for a Tier description was not returning the validated value, which meant we were unable to set the Tier description.
This commit is contained in:
parent
63fe013606
commit
a0ebb9a6f3
3 changed files with 25 additions and 0 deletions
|
@ -126,4 +126,20 @@ describe('Tiers API', function () {
|
|||
|
||||
assert(updatedTier.trial_days === 0, `The trial_days should have been set to 0`);
|
||||
});
|
||||
|
||||
it('Can edit description', async function () {
|
||||
const {body: {tiers: [tier]}} = await agent.get('/tiers/?type:paid&limit=1');
|
||||
|
||||
await agent.put(`/tiers/${tier.id}/`)
|
||||
.body({
|
||||
tiers: [{
|
||||
description: 'Updated description'
|
||||
}]
|
||||
})
|
||||
.expectStatus(200);
|
||||
|
||||
const {body: {tiers: [updatedTier]}} = await agent.get(`/tiers/${tier.id}/`);
|
||||
|
||||
assert.strictEqual('Updated description', updatedTier.description);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -338,6 +338,7 @@ function validateDescription(value) {
|
|||
message: 'Tier description must be a string with a maximum of 191 characters'
|
||||
});
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
function validateStatus(value) {
|
||||
|
|
|
@ -251,5 +251,13 @@ describe('Tier', function () {
|
|||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('Can set the description of a Tier', async function () {
|
||||
const tier = await Tier.create(validInput);
|
||||
|
||||
tier.description = 'Updated description';
|
||||
|
||||
assert.strictEqual('Updated description', tier.description);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue