mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-05-26 00:55:16 -07:00
Fix Jellyfin Login (#76)
This commit is contained in:
@@ -654,6 +654,40 @@ test('authenticateWithPassword surfaces invalid credentials and server status fa
|
||||
}
|
||||
});
|
||||
|
||||
test('authenticateWithPassword surfaces unreachable server failures', async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
globalThis.fetch = (async () => {
|
||||
throw new TypeError('fetch failed');
|
||||
}) as typeof fetch;
|
||||
|
||||
try {
|
||||
await assert.rejects(
|
||||
() => authenticateWithPassword('http://jellyfin.local:8096/', 'kyle', 'pw', clientInfo),
|
||||
/Could not reach Jellyfin server \(fetch failed\)\./,
|
||||
);
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
}
|
||||
});
|
||||
|
||||
test('authenticateWithPassword surfaces login timeouts', async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
globalThis.fetch = (async () => {
|
||||
const error = new Error('aborted') as Error & { name: string };
|
||||
error.name = 'AbortError';
|
||||
throw error;
|
||||
}) as typeof fetch;
|
||||
|
||||
try {
|
||||
await assert.rejects(
|
||||
() => authenticateWithPassword('http://jellyfin.local:8096/', 'kyle', 'pw', clientInfo),
|
||||
/Jellyfin login timed out\./,
|
||||
);
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
}
|
||||
});
|
||||
|
||||
test('listLibraries surfaces token-expiry auth errors', async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
globalThis.fetch = (async () =>
|
||||
|
||||
Reference in New Issue
Block a user