mirror of
https://github.com/kikootwo/ReadMeABook.git
synced 2026-06-03 04:40:09 +00:00
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:
@@ -38,6 +38,27 @@ describe('OIDC auth routes', () => {
|
||||
expect(response.headers.get('location')).toBe('http://oidc/login');
|
||||
});
|
||||
|
||||
it('returns error when OIDC login URL is missing', async () => {
|
||||
authProviderMock.initiateLogin.mockResolvedValue({});
|
||||
const { GET } = await import('@/app/api/auth/oidc/login/route');
|
||||
|
||||
const response = await GET();
|
||||
const payload = await response.json();
|
||||
|
||||
expect(response.status).toBe(500);
|
||||
expect(payload.error).toMatch(/Failed to generate authorization URL/);
|
||||
});
|
||||
|
||||
it('redirects to login when OIDC login initiation fails', async () => {
|
||||
authProviderMock.initiateLogin.mockRejectedValue(new Error('boom'));
|
||||
const { GET } = await import('@/app/api/auth/oidc/login/route');
|
||||
|
||||
const response = await GET();
|
||||
|
||||
expect(response.status).toBe(307);
|
||||
expect(response.headers.get('location')).toContain('/login?error=');
|
||||
});
|
||||
|
||||
it('redirects to login on missing code/state', async () => {
|
||||
const { GET } = await import('@/app/api/auth/oidc/callback/route');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user