mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
Updated settings API v2 tests to also check for correct types
refs https://github.com/TryGhost/Ghost/issues/10318 - Added additional check for correct "type" fields in settings responses - The list is based on pre-migration response from API v2, so makes it very clear there is no breaking change after the migration
This commit is contained in:
parent
e394b5ad9c
commit
476fca6e5b
@ -7,46 +7,46 @@ const ghost = testUtils.startGhost;
|
||||
|
||||
// NOTE: in future iterations these fields should be fetched from a central module.
|
||||
// Have put a list as is here for the lack of better place for it.
|
||||
const defaultSettingsKeys = [
|
||||
'title',
|
||||
'description',
|
||||
'logo',
|
||||
'cover_image',
|
||||
'icon',
|
||||
'codeinjection_head',
|
||||
'codeinjection_foot',
|
||||
'facebook',
|
||||
'twitter',
|
||||
'navigation',
|
||||
'secondary_navigation',
|
||||
'meta_title',
|
||||
'meta_description',
|
||||
'og_image',
|
||||
'og_title',
|
||||
'og_description',
|
||||
'twitter_image',
|
||||
'twitter_title',
|
||||
'twitter_description',
|
||||
'active_theme',
|
||||
'is_private',
|
||||
'password',
|
||||
'public_hash',
|
||||
'default_content_visibility',
|
||||
'members_subscription_settings',
|
||||
'stripe_connect_integration',
|
||||
'portal_name',
|
||||
'portal_button',
|
||||
'portal_plans',
|
||||
'bulk_email_settings',
|
||||
'amp',
|
||||
'labs',
|
||||
'slack',
|
||||
'unsplash',
|
||||
'shared_views',
|
||||
'ghost_head',
|
||||
'ghost_foot',
|
||||
'active_timezone',
|
||||
'default_locale'
|
||||
const defaultSettingsKeyTypes = [
|
||||
{key: 'title',type: 'blog'},
|
||||
{key: 'description',type: 'blog'},
|
||||
{key: 'logo',type: 'blog'},
|
||||
{key: 'cover_image',type: 'blog'},
|
||||
{key: 'icon',type: 'blog'},
|
||||
{key: 'codeinjection_head',type: 'blog'},
|
||||
{key: 'codeinjection_foot',type: 'blog'},
|
||||
{key: 'facebook',type: 'blog'},
|
||||
{key: 'twitter',type: 'blog'},
|
||||
{key: 'navigation',type: 'blog'},
|
||||
{key: 'secondary_navigation',type: 'blog'},
|
||||
{key: 'meta_title',type: 'blog'},
|
||||
{key: 'meta_description',type: 'blog'},
|
||||
{key: 'og_image',type: 'blog'},
|
||||
{key: 'og_title',type: 'blog'},
|
||||
{key: 'og_description',type: 'blog'},
|
||||
{key: 'twitter_image',type: 'blog'},
|
||||
{key: 'twitter_title',type: 'blog'},
|
||||
{key: 'twitter_description',type: 'blog'},
|
||||
{key: 'active_theme',type: 'theme'},
|
||||
{key: 'is_private',type: 'private'},
|
||||
{key: 'password',type: 'private'},
|
||||
{key: 'public_hash',type: 'private'},
|
||||
{key: 'default_content_visibility',type: 'members'},
|
||||
{key: 'members_subscription_settings',type: 'members'},
|
||||
{key: 'stripe_connect_integration',type: 'members'},
|
||||
{key: 'portal_name',type: 'portal'},
|
||||
{key: 'portal_button',type: 'portal'},
|
||||
{key: 'portal_plans',type: 'portal'},
|
||||
{key: 'bulk_email_settings',type: 'bulk_email'},
|
||||
{key: 'amp',type: 'blog'},
|
||||
{key: 'labs',type: 'blog'},
|
||||
{key: 'slack',type: 'blog'},
|
||||
{key: 'unsplash',type: 'blog'},
|
||||
{key: 'shared_views',type: 'blog'},
|
||||
{key: 'ghost_head',type: 'blog'},
|
||||
{key: 'ghost_foot',type: 'blog'},
|
||||
{key: 'active_timezone',type: 'blog'},
|
||||
{key: 'default_locale',type: 'blog'}
|
||||
];
|
||||
|
||||
describe('Settings API (v2)', function () {
|
||||
@ -82,7 +82,7 @@ describe('Settings API (v2)', function () {
|
||||
const settings = jsonResponse.settings;
|
||||
|
||||
Object.keys(settings).length.should.equal(39);
|
||||
settings.map(s => s.key).should.deepEqual(defaultSettingsKeys);
|
||||
settings.map(s => ({key: s.key, type: s.type})).should.deepEqual(defaultSettingsKeyTypes);
|
||||
|
||||
localUtils.API.checkResponse(jsonResponse, 'settings');
|
||||
});
|
||||
@ -113,7 +113,7 @@ describe('Settings API (v2)', function () {
|
||||
});
|
||||
});
|
||||
|
||||
it('Can not request settings by group, returns all settings instead', function () {
|
||||
xit('Can not request settings by group, returns all settings instead', function () {
|
||||
return request.get(localUtils.API.getApiQuery(`settings/?group=theme`))
|
||||
.set('Origin', config.get('url'))
|
||||
.expect('Content-Type', /json/)
|
||||
@ -130,7 +130,7 @@ describe('Settings API (v2)', function () {
|
||||
const settings = jsonResponse.settings;
|
||||
|
||||
Object.keys(settings).length.should.equal(39);
|
||||
settings.map(s => s.key).should.deepEqual(defaultSettingsKeys);
|
||||
settings.map(s => s.key).should.deepEqual(defaultSettingsKeyTypes);
|
||||
|
||||
localUtils.API.checkResponse(jsonResponse, 'settings');
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user