From 95acbbad9306faac4c71ebc9978f07d12cc4749e Mon Sep 17 00:00:00 2001 From: Fabien O'Carroll Date: Thu, 28 May 2020 12:40:49 +0200 Subject: [PATCH] Added stripe_connect_integration default setting no-issue This will be used to store the keys and other information after a sucessful Stripe Connect OAuth flow. --- core/server/data/schema/default-settings.json | 3 +++ test/unit/models/settings_spec.js | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/core/server/data/schema/default-settings.json b/core/server/data/schema/default-settings.json index bcfd1a1d20..985135e371 100644 --- a/core/server/data/schema/default-settings.json +++ b/core/server/data/schema/default-settings.json @@ -214,6 +214,9 @@ }, "members_subscription_settings": { "defaultValue": "{\"fromAddress\":\"noreply\",\"allowSelfSignup\":true,\"paymentProcessors\":[{\"adapter\":\"stripe\",\"config\":{\"secret_token\":\"\",\"public_token\":\"\",\"product\":{\"name\":\"Ghost Subscription\"},\"plans\":[{\"name\":\"Monthly\",\"currency\":\"usd\",\"interval\":\"month\",\"amount\":\"\"},{\"name\":\"Yearly\",\"currency\":\"usd\",\"interval\":\"year\",\"amount\":\"\"}]}}]}" + }, + "stripe_connect_integration": { + "defaultValue": "{}" } }, "bulk_email": { diff --git a/test/unit/models/settings_spec.js b/test/unit/models/settings_spec.js index f001ebea08..2d6512a3cd 100644 --- a/test/unit/models/settings_spec.js +++ b/test/unit/models/settings_spec.js @@ -4,6 +4,7 @@ const mockDb = require('mock-knex'); const models = require('../../../core/server/models'); const {knex} = require('../../../core/server/data/db'); const {events} = require('../../../core/server/lib/common'); +const defaultSettings = require('../../../core/server/data/schema/default-settings'); describe('Unit: models/settings', function () { before(function () { @@ -113,8 +114,12 @@ describe('Unit: models/settings', function () { return models.Settings.populateDefaults() .then(() => { + const numberOfSettings = Object.keys(defaultSettings).reduce((settings, settingGroup) => { + return settings.concat(Object.keys(defaultSettings[settingGroup])); + }, []).length; // 2 events per item - settings.added and settings.[name].added - eventSpy.callCount.should.equal(92); + eventSpy.callCount.should.equal(numberOfSettings * 2); + const eventsEmitted = eventSpy.args.map(args => args[0]); const checkEventEmitted = event => should.ok(eventsEmitted.includes(event), `${event} event should be emitted`);