4b646d40ea
refs https://github.com/TryGhost/Team/issues/1358 - added acceptance tests for members settings screen - subscription access management - default post access management - free tier management - fixed `enableLabsFlag()` test helper overwriting existing flag settings when enabling another one - updated API mocks and fixtures - matched product fixtures to default tiers-enabled products - updated product API mocks to include benefit handling
37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
export function enableLabsFlag(server, flag) {
|
|
if (!server.schema.configs.all().length) {
|
|
server.loadFixtures('configs');
|
|
}
|
|
|
|
if (!server.schema.settings.all().length) {
|
|
server.loadFixtures('settings');
|
|
}
|
|
|
|
const config = server.schema.configs.first();
|
|
config.update({enableDeveloperExperiments: true});
|
|
|
|
const existingSetting = server.db.settings.findBy({key: 'labs'}).value;
|
|
const labsSetting = existingSetting ? JSON.parse(existingSetting) : {};
|
|
labsSetting[flag] = true;
|
|
|
|
server.db.settings.update({key: 'labs'}, {value: JSON.stringify(labsSetting)});
|
|
}
|
|
|
|
export function disableLabsFlag(server, flag) {
|
|
if (!server.schema.configs.all().length) {
|
|
server.loadFixtures('configs');
|
|
}
|
|
|
|
if (!server.schema.settings.all().length) {
|
|
server.loadFixtures('settings');
|
|
}
|
|
|
|
const config = server.schema.configs.first();
|
|
config.update({enableDeveloperExperiments: true});
|
|
|
|
const labsSetting = {};
|
|
labsSetting[flag] = false;
|
|
|
|
server.db.settings.update({key: 'labs'}, {value: JSON.stringify(labsSetting)});
|
|
}
|