diff --git a/web/src/lib/components/MobileNavDrawer.test.ts b/web/src/lib/components/MobileNavDrawer.test.ts index a1e66b48..8786f89a 100644 --- a/web/src/lib/components/MobileNavDrawer.test.ts +++ b/web/src/lib/components/MobileNavDrawer.test.ts @@ -30,7 +30,11 @@ describe('MobileNavDrawer', () => { render(MobileNavDrawer); const aside = screen.getByLabelText('Main navigation'); expect(aside.getAttribute('aria-hidden')).toBe('true'); - expect(aside.hasAttribute('inert')).toBe(true); + // Svelte 5 + jsdom binds `inert` as a property, not always as an + // attribute. Mirror the pattern used in QueueDrawer.test.ts. + const inertProp = (aside as unknown as { inert?: boolean }).inert === true; + const inertAttr = aside.hasAttribute('inert'); + expect(inertProp || inertAttr).toBe(true); }); it('flips to visible when mobileNav opens', async () => { diff --git a/web/src/routes/admin/integrations/integrations.test.ts b/web/src/routes/admin/integrations/integrations.test.ts index a89eb2be..e5b295b4 100644 --- a/web/src/routes/admin/integrations/integrations.test.ts +++ b/web/src/routes/admin/integrations/integrations.test.ts @@ -198,28 +198,37 @@ function providerCard(providerName: string): HTMLElement { describe('/admin/integrations', () => { test('Save calls putLidarrConfig with empty api_key when input is blank', async () => { setup(); + // Save now runs Test first (commit bca8622); mock both endpoints. The + // test response also has to match enough of the existing config that + // the Save handler treats it as a valid passthrough. + (testLidarrConnection as ReturnType).mockResolvedValueOnce(testResponseOk); (putLidarrConfig as ReturnType).mockResolvedValueOnce(cfgConnected); await fireEvent.click(within(lidarrSection()).getByRole('button', { name: /save changes/i })); - expect(putLidarrConfig).toHaveBeenCalledWith( - expect.objectContaining({ - enabled: true, - base_url: 'http://lidarr.local', - api_key: '', - default_quality_profile_id: 1, - default_root_folder_path: '/music' - }) - ); + await waitFor(() => { + expect(putLidarrConfig).toHaveBeenCalledWith( + expect.objectContaining({ + enabled: true, + base_url: 'http://lidarr.local', + api_key: '', + default_quality_profile_id: 1, + default_root_folder_path: '/music' + }) + ); + }); }); test('Save with new api_key sends the typed value', async () => { setup(); const apiInput = screen.getByPlaceholderText(/saved — leave empty to keep/i); await fireEvent.input(apiInput, { target: { value: 'newkey' } }); + (testLidarrConnection as ReturnType).mockResolvedValueOnce(testResponseOk); (putLidarrConfig as ReturnType).mockResolvedValueOnce(cfgConnected); await fireEvent.click(within(lidarrSection()).getByRole('button', { name: /save changes/i })); - expect(putLidarrConfig).toHaveBeenCalledWith( - expect.objectContaining({ api_key: 'newkey' }) - ); + await waitFor(() => { + expect(putLidarrConfig).toHaveBeenCalledWith( + expect.objectContaining({ api_key: 'newkey' }) + ); + }); }); test('Test connection renders Lidarr version on success', async () => {