test: use snapshots for manifest config tests

This commit is contained in:
WebStreamr 2025-06-09 11:24:38 +00:00
parent 315588bc78
commit 6dff634299
No known key found for this signature in database
2 changed files with 54 additions and 12 deletions

View file

@ -0,0 +1,52 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`buildManifest has checked handler with appropriate config 1`] = `
[
{
"default": "checked",
"key": "de",
"title": "German 🇩🇪 (KinoKiste, MeineCloud)",
"type": "checkbox",
},
{
"key": "es",
"title": "Castilian Spanish 🇪🇸 (VerHdLink)",
"type": "checkbox",
},
{
"key": "mx",
"title": "Latin American Spanish 🇲🇽 (VerHdLink)",
"type": "checkbox",
},
{
"key": "excludeExternalUrls",
"title": "Exclude external URLs from results",
"type": "checkbox",
},
]
`;
exports[`buildManifest has unchecked handler without a config 1`] = `
[
{
"key": "de",
"title": "German 🇩🇪 (KinoKiste, MeineCloud)",
"type": "checkbox",
},
{
"key": "es",
"title": "Castilian Spanish 🇪🇸 (VerHdLink)",
"type": "checkbox",
},
{
"key": "mx",
"title": "Latin American Spanish 🇲🇽 (VerHdLink)",
"type": "checkbox",
},
{
"key": "excludeExternalUrls",
"title": "Exclude external URLs from results",
"type": "checkbox",
},
]
`;

View file

@ -20,12 +20,7 @@ describe('buildManifest', () => {
const manifest = buildManifest(handlers, {});
expect(manifest.config).toStrictEqual([
{ key: 'de', type: 'checkbox', title: 'German 🇩🇪 (KinoKiste, MeineCloud)' },
{ key: 'es', type: 'checkbox', title: 'Castilian Spanish 🇪🇸 (VerHdLink)' },
{ key: 'mx', type: 'checkbox', title: 'Latin American Spanish 🇲🇽 (VerHdLink)' },
{ key: 'excludeExternalUrls', type: 'checkbox', title: 'Exclude external URLs from results' },
]);
expect(manifest.config).toMatchSnapshot();
});
test('has checked handler with appropriate config', () => {
@ -37,11 +32,6 @@ describe('buildManifest', () => {
];
const manifest = buildManifest(handlers, { de: 'on' });
expect(manifest.config).toStrictEqual([
{ key: 'de', type: 'checkbox', title: 'German 🇩🇪 (KinoKiste, MeineCloud)', default: 'checked' },
{ key: 'es', type: 'checkbox', title: 'Castilian Spanish 🇪🇸 (VerHdLink)' },
{ key: 'mx', type: 'checkbox', title: 'Latin American Spanish 🇲🇽 (VerHdLink)' },
{ key: 'excludeExternalUrls', type: 'checkbox', title: 'Exclude external URLs from results' },
]);
expect(manifest.config).toMatchSnapshot();
});
});