0
Fork 0
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:
Fabien 'egg' O'Carroll 2022-11-01 16:25:55 +07:00 committed by GitHub
parent 63fe013606
commit a0ebb9a6f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 0 deletions

View file

@ -126,4 +126,20 @@ describe('Tiers API', function () {
assert(updatedTier.trial_days === 0, `The trial_days should have been set to 0`); 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);
});
}); });

View file

@ -338,6 +338,7 @@ function validateDescription(value) {
message: 'Tier description must be a string with a maximum of 191 characters' message: 'Tier description must be a string with a maximum of 191 characters'
}); });
} }
return value;
} }
function validateStatus(value) { function validateStatus(value) {

View file

@ -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);
});
}); });
}); });