mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-28 05:37:34 +03:00
Removed need for snapshot updates for feature flags
- prior to this commit, if you add or remove a faeture flag, you also have to update the snapshots for the settings tests - feature flags are intended to be very easy to add and remove, and so this extra step doesn't fit with our needs - it's also unnecessary, we don't need to verify the exact contents of the labs setting
This commit is contained in:
parent
54aa9f016b
commit
22fd7f289c
@ -230,7 +230,7 @@ Object {
|
||||
},
|
||||
Object {
|
||||
"key": "labs",
|
||||
"value": "{\\"activitypub\\":true,\\"auditLog\\":true,\\"urlCache\\":true,\\"beforeAfterCard\\":true,\\"freeTrial\\":true,\\"newsletterPaywall\\":true,\\"members\\":true}",
|
||||
"value": StringMatching /\\\\\\{\\[\\^\\\\s\\]\\+\\\\\\}/,
|
||||
},
|
||||
Object {
|
||||
"key": "slack_url",
|
||||
@ -569,7 +569,7 @@ Object {
|
||||
},
|
||||
Object {
|
||||
"key": "labs",
|
||||
"value": "{\\"newsletterPaywall\\":true,\\"members\\":true}",
|
||||
"value": StringMatching /\\\\\\{\\[\\^\\\\s\\]\\+\\\\\\}/,
|
||||
},
|
||||
Object {
|
||||
"key": "slack_url",
|
||||
@ -858,7 +858,7 @@ Object {
|
||||
},
|
||||
Object {
|
||||
"key": "labs",
|
||||
"value": "{\\"newsletterPaywall\\":true,\\"members\\":true}",
|
||||
"value": StringMatching /\\\\\\{\\[\\^\\\\s\\]\\+\\\\\\}/,
|
||||
},
|
||||
Object {
|
||||
"key": "slack_url",
|
||||
@ -1146,7 +1146,7 @@ Object {
|
||||
},
|
||||
Object {
|
||||
"key": "labs",
|
||||
"value": "{\\"newsletterPaywall\\":true,\\"members\\":true}",
|
||||
"value": StringMatching /\\\\\\{\\[\\^\\\\s\\]\\+\\\\\\}/,
|
||||
},
|
||||
Object {
|
||||
"key": "slack_url",
|
||||
@ -1439,7 +1439,7 @@ Object {
|
||||
},
|
||||
Object {
|
||||
"key": "labs",
|
||||
"value": "{\\"newsletterPaywall\\":true,\\"members\\":true}",
|
||||
"value": StringMatching /\\\\\\{\\[\\^\\\\s\\]\\+\\\\\\}/,
|
||||
},
|
||||
Object {
|
||||
"key": "slack_url",
|
||||
@ -1727,7 +1727,7 @@ Object {
|
||||
},
|
||||
Object {
|
||||
"key": "labs",
|
||||
"value": "{\\"newsletterPaywall\\":true,\\"members\\":true}",
|
||||
"value": StringMatching /\\\\\\{\\[\\^\\\\s\\]\\+\\\\\\}/,
|
||||
},
|
||||
Object {
|
||||
"key": "slack_url",
|
||||
@ -2078,7 +2078,7 @@ Object {
|
||||
},
|
||||
Object {
|
||||
"key": "labs",
|
||||
"value": "{\\"newsletterPaywall\\":true,\\"members\\":true}",
|
||||
"value": StringMatching /\\\\\\{\\[\\^\\\\s\\]\\+\\\\\\}/,
|
||||
},
|
||||
Object {
|
||||
"key": "slack_url",
|
||||
|
@ -15,6 +15,10 @@ const publicHashSettingMatcher = {
|
||||
value: stringMatching(/[a-z0-9]{30}/)
|
||||
};
|
||||
|
||||
const labsSettingMatcher = {
|
||||
value: stringMatching(/\{[^\s]+\}/)
|
||||
};
|
||||
|
||||
const matchSettingsArray = (length) => {
|
||||
const settingsArray = new Array(length).fill(settingsMatcher);
|
||||
|
||||
@ -23,6 +27,11 @@ const matchSettingsArray = (length) => {
|
||||
settingsArray[25] = publicHashSettingMatcher;
|
||||
}
|
||||
|
||||
if (length > 56) {
|
||||
// Item at index 56 is the lab settings, which changes as we add and remove features
|
||||
settingsArray[56] = labsSettingMatcher;
|
||||
}
|
||||
|
||||
return settingsArray;
|
||||
};
|
||||
|
||||
@ -190,7 +199,7 @@ describe('Settings API', function () {
|
||||
.matchHeaderSnapshot({
|
||||
etag: anyEtag
|
||||
});
|
||||
|
||||
|
||||
// Check returned WITH prefix
|
||||
const val = body.settings.find(setting => setting.key === 'icon');
|
||||
assert.ok(val);
|
||||
@ -243,11 +252,11 @@ describe('Settings API', function () {
|
||||
});
|
||||
});
|
||||
|
||||
mockManager.assert.sentEmailCount(1);
|
||||
mockManager.assert.sentEmailCount(1);
|
||||
mockManager.assert.sentEmail({
|
||||
subject: 'Verify email address',
|
||||
to: 'support@example.com'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
it('does not trigger email verification flow if members_support_address remains the same', async function () {
|
||||
@ -402,7 +411,7 @@ describe('Settings API', function () {
|
||||
to: 'test@test.com'
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
it('can do validateMembersEmailUpdate', async function () {
|
||||
const magicLink = await membersService.api.getMagicLink('test@test.com');
|
||||
const magicLinkUrl = new URL(magicLink);
|
||||
|
Loading…
Reference in New Issue
Block a user