mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-11 08:43:59 +03:00
🐛 Fixed config API not returning boolean
no-issue The mailgunIsConfigured config should be a boolean, rather than a string/undefined/null.
This commit is contained in:
parent
ce0e1b8b0c
commit
26ef4afdb9
@ -15,7 +15,7 @@ module.exports = function getConfigProperties() {
|
||||
clientExtensions: config.get('clientExtensions') || {},
|
||||
enableDeveloperExperiments: config.get('enableDeveloperExperiments') || false,
|
||||
stripeDirect: config.get('stripeDirect'),
|
||||
mailgunIsConfigured: config.get('bulkEmail') && config.get('bulkEmail').mailgun,
|
||||
mailgunIsConfigured: !!(config.get('bulkEmail') && config.get('bulkEmail').mailgun),
|
||||
emailAnalytics: config.get('emailAnalytics'),
|
||||
hostSettings: config.get('hostSettings'),
|
||||
tenor: config.get('tenor')
|
||||
|
@ -34,4 +34,36 @@ describe('Config API', function () {
|
||||
// full version
|
||||
res.body.config.version.should.match(/\d+\.\d+\.\d+/);
|
||||
});
|
||||
|
||||
describe('mailgunIsConfigured', function () {
|
||||
it('is a boolean when it is configured', async function () {
|
||||
// set any non-default keys so we can be sure they're exposed
|
||||
configUtils.set('bulkEmail', {
|
||||
mailgun: 'exists'
|
||||
});
|
||||
|
||||
const res = await request
|
||||
.get(localUtils.API.getApiQuery('config/'))
|
||||
.set('Origin', config.get('url'))
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200);
|
||||
|
||||
should.equal(typeof res.body.config.mailgunIsConfigured, 'boolean');
|
||||
});
|
||||
|
||||
it('is a boolean when it is not configured', async function () {
|
||||
// set any non-default keys so we can be sure they're exposed
|
||||
configUtils.set('bulkEmail', {});
|
||||
|
||||
const res = await request
|
||||
.get(localUtils.API.getApiQuery('config/'))
|
||||
.set('Origin', config.get('url'))
|
||||
.expect('Content-Type', /json/)
|
||||
.expect('Cache-Control', testUtils.cacheRules.private)
|
||||
.expect(200);
|
||||
|
||||
should.equal(typeof res.body.config.mailgunIsConfigured, 'boolean');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -29,7 +29,7 @@ const expectedProperties = {
|
||||
|
||||
action: ['id', 'resource_type', 'actor_type', 'event', 'created_at', 'actor'],
|
||||
|
||||
config: ['version', 'environment', 'database', 'mail', 'labs', 'clientExtensions', 'enableDeveloperExperiments', 'useGravatar', 'stripeDirect', 'emailAnalytics', 'tenor'],
|
||||
config: ['version', 'environment', 'database', 'mail', 'labs', 'clientExtensions', 'enableDeveloperExperiments', 'useGravatar', 'stripeDirect', 'emailAnalytics', 'tenor', 'mailgunIsConfigured'],
|
||||
|
||||
post: [
|
||||
'id',
|
||||
|
Loading…
Reference in New Issue
Block a user