Skip to content

Commit 4a74a0f

Browse files
Update config to v5 (#1770)
* Update config * Add basic unit test to ensure preview is disabled
1 parent f01d7ff commit 4a74a0f

File tree

4 files changed

+38
-6
lines changed

4 files changed

+38
-6
lines changed

injected/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
"seedrandom": "^3.0.5",
3131
"sjcl": "^1.0.8",
3232
"minimist": "^1.2.8",
33-
"@duckduckgo/privacy-configuration": "github:duckduckgo/privacy-configuration#2c569c49990bae4ac83578fc9eaef282489d7926",
33+
"@duckduckgo/privacy-configuration": "github:duckduckgo/privacy-configuration#10be120b4630107863ef6ffa228ccabc831be1c2",
3434
"esbuild": "^0.25.4",
3535
"urlpattern-polyfill": "^10.1.0"
3636
},

injected/unit-test/features.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -103,10 +103,10 @@ describe('test-pages/*/config/*.json schema validation', () => {
103103
xit(`LEGACY: skipped schema validation for ${path.relative(process.cwd(), configPath)}`, () => {});
104104
continue;
105105
}
106-
it(`should match the GenericV4Config schema: ${path.relative(process.cwd(), configPath)}`, async () => {
106+
it(`should match the CurrentGenericConfig schema: ${path.relative(process.cwd(), configPath)}`, async () => {
107107
let config = JSON.parse(await readFile(configPath, 'utf-8'));
108108
config = ensureHashOnFeatures(config);
109-
const validate = createValidator('GenericV4Config');
109+
const validate = createValidator('CurrentGenericConfig');
110110
const valid = validate(config);
111111
if (!valid) {
112112
throw new Error(`Schema validation failed for ${configPath}: ` + formatErrors(validate.errors));

injected/unit-test/utils.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,38 @@ describe('Helpers checks', () => {
180180
});
181181
});
182182

183+
it('does not enable features with state "preview"', () => {
184+
const configIn = {
185+
features: {
186+
testFeature: {
187+
state: 'enabled',
188+
settings: {},
189+
exceptions: [],
190+
},
191+
previewFeature: {
192+
state: 'preview',
193+
settings: {},
194+
exceptions: [],
195+
},
196+
},
197+
unprotectedTemporary: [],
198+
};
199+
const processedConfig = processConfig(
200+
configIn,
201+
[],
202+
{
203+
platform: {
204+
name: 'android',
205+
},
206+
versionNumber: 99,
207+
sessionKey: 'testSessionKey',
208+
},
209+
[],
210+
);
211+
expect(processedConfig.site.enabledFeatures).toEqual(['testFeature']);
212+
expect(processedConfig.featureSettings).toEqual({ testFeature: {} });
213+
});
214+
183215
describe('utils.satisfiesMinVersion', () => {
184216
// Min version, Extension version, outcome
185217
/** @type {[string, string, boolean][]} */

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)