fix: config checkbox handling of includeExternalUrls

This commit is contained in:
WebStreamr 2025-06-19 12:13:36 +00:00
parent 138e92afc5
commit b5855aaab4
No known key found for this signature in database
3 changed files with 36 additions and 1 deletions

View file

@ -1,5 +1,16 @@
// Jest Snapshot v1, https://jestjs.io/docs/snapshot-testing
exports[`buildManifest has checked includeExternalUrls 1`] = `
[
{
"default": "checked",
"key": "includeExternalUrls",
"title": "Include external URLs from results",
"type": "checkbox",
},
]
`;
exports[`buildManifest has checked source with appropriate config 1`] = `
[
{
@ -19,6 +30,7 @@ exports[`buildManifest has checked source with appropriate config 1`] = `
"type": "checkbox",
},
{
"default": "checked",
"key": "includeExternalUrls",
"title": "Include external URLs from results",
"type": "checkbox",
@ -50,3 +62,13 @@ exports[`buildManifest has unchecked source without a config 1`] = `
},
]
`;
exports[`buildManifest includeExternalUrls is unchecked by default 1`] = `
[
{
"key": "includeExternalUrls",
"title": "Include external URLs from results",
"type": "checkbox",
},
]
`;

View file

@ -23,7 +23,19 @@ describe('buildManifest', () => {
new StreamKiste(fetcher),
new MeineCloud(fetcher),
];
const manifest = buildManifest(sources, { de: 'on' });
const manifest = buildManifest(sources, { de: 'on', includeExternalUrls: 'on' });
expect(manifest.config).toMatchSnapshot();
});
test('includeExternalUrls is unchecked by default', () => {
const manifest = buildManifest([], {});
expect(manifest.config).toMatchSnapshot();
});
test('has checked includeExternalUrls', () => {
const manifest = buildManifest([], { includeExternalUrls: 'on' });
expect(manifest.config).toMatchSnapshot();
});

View file

@ -54,6 +54,7 @@ export const buildManifest = (sources: Source[], config: Config): ManifestWithCo
key: 'includeExternalUrls',
type: 'checkbox',
title: 'Include external URLs from results',
...('includeExternalUrls' in config && { default: 'checked' }),
});
return manifest;