From 6dff63429948b596a9a5bafd0c50861bc8bd4930 Mon Sep 17 00:00:00 2001 From: WebStreamr <210764791+webstreamr@users.noreply.github.com> Date: Mon, 9 Jun 2025 11:24:38 +0000 Subject: [PATCH] test: use snapshots for manifest config tests --- src/utils/__snapshots__/manifest.test.ts.snap | 52 +++++++++++++++++++ src/utils/manifest.test.ts | 14 +---- 2 files changed, 54 insertions(+), 12 deletions(-) create mode 100644 src/utils/__snapshots__/manifest.test.ts.snap diff --git a/src/utils/__snapshots__/manifest.test.ts.snap b/src/utils/__snapshots__/manifest.test.ts.snap new file mode 100644 index 0000000..91c5657 --- /dev/null +++ b/src/utils/__snapshots__/manifest.test.ts.snap @@ -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", + }, +] +`; diff --git a/src/utils/manifest.test.ts b/src/utils/manifest.test.ts index c0ab4f3..eb2ab3f 100644 --- a/src/utils/manifest.test.ts +++ b/src/utils/manifest.test.ts @@ -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(); }); });