Ghost/ghost/admin/mirage/fixtures/settings.js
Kevin Ansfield b123b297b6 Improved test settings fixtures
no issue

- the settings fixtures file was becoming hard to use because settings have been appended to it on an as-used basis which meant it was difficult to reason about the base-state in acceptance tests and was never really in sync with the default settings state for a Ghost site
- added a utility function to create a settings object with the `id` defined to avoid problems with manually updating the ids in the list
- updated to include all default settings with their default values if not already set to a specific testing value in the old fixtures
2022-05-30 14:09:29 +01:00

118 lines
4.2 KiB
JavaScript

/* eslint-disable camelcase */
import moment from 'moment';
let id = 0;
function setting(group, key, value) {
id = id + 1;
return {
id,
group,
key,
value,
updated_at: moment.utc().format(),
updated_by: 1,
created_at: moment.utc().format(),
created_by: 1
};
}
// These settings represent a default new site setup
// Real default settings can be found in https://github.com/TryGhost/Ghost/blob/main/core/server/data/schema/default-settings/default-settings.json
export default [
// SITE
setting('site', 'title', 'Test Blog'),
setting('site', 'description', 'Thoughts, stories and ideas'),
setting('site', 'logo', '/content/images/2013/Nov/logo.png'),
setting('site', 'cover_image', '/content/images/2014/Feb/cover.jpg'),
setting('site', 'icon', '/content/images/2014/Feb/favicon.ico'),
setting('site', 'accent_color', '#ff1a75'),
setting('site', 'locale', 'en'),
setting('site', 'timezone', 'Etc/UTC'),
setting('site', 'codeinjection_head', null),
setting('site', 'codeinjection_foot', null),
setting('site', 'facebook', 'test'),
setting('site', 'twitter', '@test'),
setting('site', 'navigation', JSON.stringify([
{label: 'Home', url: '/'},
{label: 'About', url: '/about'}
])),
setting('site', 'secondary_navigation', JSON.stringify([])),
setting('site', 'meta_title', null),
setting('site', 'meta_description', null),
setting('site', 'og_image', null),
setting('site', 'og_title', null),
setting('site', 'og_description', null),
setting('site', 'twitter_image', null),
setting('site', 'twitter_title', null),
setting('site', 'twitter_description', null),
// THEME
setting('theme', 'active_theme', 'Casper'),
// PRIVATE
setting('private', 'is_private', 'false'),
setting('private', 'password', ''),
setting('private', 'public_hash', ''),
// MEMBERS
setting('members', 'default_content_visibility', 'public'),
setting('members', 'default_content_visibility_tiers', JSON.stringify([])),
setting('members', 'members_signup_access', 'all'),
setting('members', 'members_support_address', 'noreply'),
setting('members', 'stripe_secret_key', null),
setting('members', 'stripe_publishable_key', null),
setting('members', 'stripe_plans', JSON.stringify([])),
setting('members', 'stripe_connect_publishable_key', 'pk_test_for_stripe'),
setting('members', 'stripe_connect_secret_key', 'sk_test_for_stripe'),
setting('members', 'stripe_connect_livemode', null),
setting('members', 'stripe_connect_display_name', null),
setting('members', 'stripe_connect_account_id', null),
setting('members', 'members_monthly_price_id', null),
setting('members', 'members_yearly_price_id', null),
// PORTAL
setting('portal', 'portal_name', 'true'),
setting('portal', 'portal_button', 'true'),
setting('portal', 'portal_plans', JSON.stringify(['free'])),
setting('portal', 'portal_products', JSON.stringify([])),
setting('portal', 'portal_button_style', 'icon-and-text'),
setting('portal', 'portal_button_icon', null),
setting('portal', 'portal_button_signup_text', 'Subscribe'),
// EMAIL
setting('email', 'mailgun_domain', null),
setting('email', 'mailgun_api_key', null),
setting('email', 'mailgun_base_url', null),
setting('email', 'email_track_opens', 'true'),
setting('email', 'email_verification_required', 'false'),
// AMP
setting('amp', 'amp', 'false'),
setting('amp', 'amp_gtag_id', null),
// FIRSTPROMOTER
setting('firstpromoter', 'firstpromoter', 'false'),
setting('firstpromoter', 'firstpromoter_id', null),
// LABS
setting('labs', 'labs', JSON.stringify({
// Keep the GA flags that are not yet cleaned up in frontend code here
})),
// SLACK
setting('slack', 'slack_url', ''),
setting('slack', 'slack_username', 'Ghost'),
// UNSPLASH
setting('unsplash', 'unsplash', 'true'),
// VIEWS
setting('views', 'shared_views', JSON.stringify([])),
// EDITOR
setting('editor', 'editor_default_email_recipients', 'visibility'),
setting('editor', 'editor_default_email_recipients_filter', 'all')
];