mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-03-02 06:22:42 -08:00
Jellyfin and Subsync Fixes (#13)
This commit is contained in:
@@ -87,6 +87,10 @@ test('listItems supports search and formats title', async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
globalThis.fetch = (async (input) => {
|
||||
assert.match(String(input), /SearchTerm=planet/);
|
||||
assert.match(
|
||||
String(input),
|
||||
/IncludeItemTypes=Movie%2CEpisode%2CAudio%2CSeries%2CSeason%2CFolder%2CCollectionFolder/,
|
||||
);
|
||||
return new Response(
|
||||
JSON.stringify({
|
||||
Items: [
|
||||
@@ -125,6 +129,64 @@ test('listItems supports search and formats title', async () => {
|
||||
}
|
||||
});
|
||||
|
||||
test('listItems keeps playable-only include types when search is empty', async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
globalThis.fetch = (async (input) => {
|
||||
assert.match(String(input), /IncludeItemTypes=Movie%2CEpisode%2CAudio/);
|
||||
assert.doesNotMatch(String(input), /CollectionFolder|Series|Season|Folder/);
|
||||
return new Response(JSON.stringify({ Items: [] }), { status: 200 });
|
||||
}) as typeof fetch;
|
||||
|
||||
try {
|
||||
const items = await listItems(
|
||||
{
|
||||
serverUrl: 'http://jellyfin.local',
|
||||
accessToken: 'token',
|
||||
userId: 'u1',
|
||||
username: 'kyle',
|
||||
},
|
||||
clientInfo,
|
||||
{
|
||||
libraryId: 'lib-1',
|
||||
limit: 25,
|
||||
},
|
||||
);
|
||||
assert.deepEqual(items, []);
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
}
|
||||
});
|
||||
|
||||
test('listItems accepts explicit include types and recursive mode', async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
globalThis.fetch = (async (input) => {
|
||||
assert.match(String(input), /Recursive=false/);
|
||||
assert.match(String(input), /IncludeItemTypes=Series%2CMovie%2CFolder/);
|
||||
return new Response(JSON.stringify({ Items: [] }), { status: 200 });
|
||||
}) as typeof fetch;
|
||||
|
||||
try {
|
||||
const items = await listItems(
|
||||
{
|
||||
serverUrl: 'http://jellyfin.local',
|
||||
accessToken: 'token',
|
||||
userId: 'u1',
|
||||
username: 'kyle',
|
||||
},
|
||||
clientInfo,
|
||||
{
|
||||
libraryId: 'lib-1',
|
||||
includeItemTypes: 'Series,Movie,Folder',
|
||||
recursive: false,
|
||||
limit: 25,
|
||||
},
|
||||
);
|
||||
assert.deepEqual(items, []);
|
||||
} finally {
|
||||
globalThis.fetch = originalFetch;
|
||||
}
|
||||
});
|
||||
|
||||
test('resolvePlaybackPlan chooses direct play when allowed', async () => {
|
||||
const originalFetch = globalThis.fetch;
|
||||
globalThis.fetch = (async () =>
|
||||
|
||||
Reference in New Issue
Block a user