Add series fields to audiobooks and update related logic

Introduces 'series' and 'seriesPart' fields to the Audiobook model and database schema. Updates API routes, file organization, and path template utilities to support series metadata. Enhances chapter merging logic, improves notification backend testing, and expands test coverage for admin and API routes.
This commit is contained in:
kikootwo
2026-01-22 15:56:55 -05:00
parent dc7e557694
commit 31bca0052f
105 changed files with 10384 additions and 75 deletions
+72
View File
@@ -0,0 +1,72 @@
/**
* Component: Setup Review Step Tests
* Documentation: documentation/setup-wizard.md
*/
// @vitest-environment jsdom
import React from 'react';
import { fireEvent, render, screen } from '@testing-library/react';
import { describe, expect, it, vi } from 'vitest';
import { ReviewStep } from '@/app/setup/steps/ReviewStep';
const baseConfig = {
backendMode: 'plex' as const,
plexUrl: 'http://plex.local',
plexLibraryId: 'plex-lib',
absUrl: 'http://abs.local',
absLibraryId: 'abs-lib',
authMethod: 'oidc' as const,
oidcProviderName: 'Auth',
adminUsername: 'admin',
prowlarrUrl: 'http://prowlarr.local',
downloadClient: 'qbittorrent' as const,
downloadClientUrl: 'http://qb.local',
downloadDir: '/downloads',
mediaDir: '/media',
bookdateConfigured: true,
bookdateProvider: 'openai',
bookdateModel: 'model-1',
};
describe('ReviewStep', () => {
it('renders Plex configuration and triggers actions', async () => {
const onComplete = vi.fn();
const onBack = vi.fn();
render(
<ReviewStep
config={baseConfig}
loading={false}
error={null}
onComplete={onComplete}
onBack={onBack}
/>
);
expect(screen.getByText('Plex Media Server')).toBeInTheDocument();
expect(screen.getByText('BookDate AI Recommendations')).toBeInTheDocument();
fireEvent.click(screen.getByRole('button', { name: 'Back' }));
fireEvent.click(screen.getByRole('button', { name: 'Complete Setup' }));
expect(onBack).toHaveBeenCalled();
expect(onComplete).toHaveBeenCalled();
});
it('renders Audiobookshelf config and error state', async () => {
render(
<ReviewStep
config={{ ...baseConfig, backendMode: 'audiobookshelf', authMethod: 'both' }}
loading={false}
error="Something went wrong"
onComplete={vi.fn()}
onBack={vi.fn()}
/>
);
expect(screen.getByText('Audiobookshelf')).toBeInTheDocument();
expect(screen.getByText('OIDC + Manual Registration')).toBeInTheDocument();
expect(screen.getByText('Something went wrong')).toBeInTheDocument();
});
});