@@ -132,6 +132,26 @@ void main() {
|
||||
expect(harness.loadedLibraries, [harness.libraryA.globalKey]);
|
||||
expect(groupingChip.focusNode!.hasFocus, isTrue);
|
||||
});
|
||||
|
||||
testWidgets('mixed library all grouping applies its explicit root kinds', (tester) async {
|
||||
final client = _BrowseClient('server-a', 'Mixed');
|
||||
final harness = _BrowseHarness(clientA: client);
|
||||
addTearDown(harness.dispose);
|
||||
harness.selectedLibrary.value = MediaLibrary(
|
||||
id: 'mixed-library',
|
||||
backend: MediaBackend.jellyfin,
|
||||
title: 'Mixed',
|
||||
defaultBrowseKinds: const [MediaKind.movie, MediaKind.show],
|
||||
serverId: client.serverId,
|
||||
);
|
||||
|
||||
await _pumpHarness(tester, harness);
|
||||
|
||||
expect(client.pageQueries, hasLength(1));
|
||||
expect(client.pageQueries.single.kind, isNull);
|
||||
expect(client.pageQueries.single.includeKinds, const [MediaKind.movie, MediaKind.show]);
|
||||
expect(client.pageLibraryKinds.single, MediaKind.unknown);
|
||||
});
|
||||
}
|
||||
|
||||
Future<void> _pumpHarness(WidgetTester tester, _BrowseHarness harness, {bool settle = true}) async {
|
||||
@@ -257,6 +277,8 @@ class _BrowseClient implements MediaServerClient {
|
||||
final Queue<Future<LibraryPage<MediaItem>> Function()> pageResponses = Queue();
|
||||
var sortRequestCount = 0;
|
||||
var pageRequestCount = 0;
|
||||
final List<LibraryQuery> pageQueries = [];
|
||||
final List<MediaKind?> pageLibraryKinds = [];
|
||||
|
||||
_BrowseClient(String serverId, this.itemTitle, {this.sortResponse}) : serverId = ServerId(serverId);
|
||||
|
||||
@@ -288,6 +310,8 @@ class _BrowseClient implements MediaServerClient {
|
||||
AbortController? abort,
|
||||
}) {
|
||||
pageRequestCount++;
|
||||
pageQueries.add(query);
|
||||
pageLibraryKinds.add(libraryKind);
|
||||
if (pageResponses.isNotEmpty) return pageResponses.removeFirst()();
|
||||
return Future.value(_pageFor(this, itemTitle));
|
||||
}
|
||||
|
||||
@@ -2342,6 +2342,8 @@ void main() {
|
||||
expect(albumBrowse['Fields'], 'PremiereDate,OriginalTitle,SortName');
|
||||
expect(albumBrowse['EnableUserData'], 'false');
|
||||
expect(trackBrowse['Fields'], 'UserData,PremiereDate,OriginalTitle,SortName');
|
||||
expect(albumBrowse['IncludeItemTypes'], 'MusicAlbum');
|
||||
expect(trackBrowse['IncludeItemTypes'], 'Audio');
|
||||
expect(trackBrowse.containsKey('EnableUserData'), isFalse);
|
||||
expect(artistAlbums['Fields'], 'PremiereDate,OriginalTitle,SortName');
|
||||
expect(artistAlbums['EnableUserData'], 'false');
|
||||
|
||||
@@ -474,13 +474,22 @@ void main() {
|
||||
}
|
||||
});
|
||||
|
||||
test('falls back to MediaKind.unknown for unrecognised collections', () {
|
||||
final lib = JellyfinMappers.library({
|
||||
'Id': 'view-x',
|
||||
test('maps mixed collections to a movie and show root browse', () {
|
||||
final mixed = JellyfinMappers.library({
|
||||
'Id': 'view-mixed',
|
||||
'Name': 'Mixed',
|
||||
'CollectionType': 'mixed',
|
||||
}, serverId: ServerId(_serverId))!;
|
||||
expect(lib.kind, MediaKind.unknown);
|
||||
expect(mixed.kind, MediaKind.unknown);
|
||||
expect(mixed.defaultBrowseKinds, const [MediaKind.movie, MediaKind.show]);
|
||||
|
||||
final unrecognised = JellyfinMappers.library({
|
||||
'Id': 'view-books',
|
||||
'Name': 'Books',
|
||||
'CollectionType': 'books',
|
||||
}, serverId: ServerId(_serverId))!;
|
||||
expect(unrecognised.kind, MediaKind.unknown);
|
||||
expect(unrecognised.defaultBrowseKinds, isEmpty);
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -21,6 +21,11 @@ void main() {
|
||||
expect(params['type'], '2');
|
||||
});
|
||||
|
||||
test('multiple kinds map to a comma-delimited type filter', () {
|
||||
final params = translator.toQueryParameters(const LibraryQuery(includeKinds: [MediaKind.movie, MediaKind.show]));
|
||||
expect(params['type'], '1,2');
|
||||
});
|
||||
|
||||
test('collection kind has no Plex type number (filtered separately)', () {
|
||||
final params = translator.toQueryParameters(const LibraryQuery(kind: MediaKind.collection));
|
||||
expect(params, isNot(contains('type')));
|
||||
@@ -98,6 +103,13 @@ void main() {
|
||||
expect(params['IncludeItemTypes'], 'Series');
|
||||
});
|
||||
|
||||
test('multiple kinds map to combined IncludeItemTypes', () {
|
||||
final params = translator.toQueryParameters(
|
||||
const LibraryQuery(kind: MediaKind.episode, includeKinds: [MediaKind.movie, MediaKind.show]),
|
||||
);
|
||||
expect(params['IncludeItemTypes'], 'Movie,Series');
|
||||
});
|
||||
|
||||
test('collection kind maps to IncludeItemTypes=BoxSet', () {
|
||||
final params = translator.toQueryParameters(const LibraryQuery(kind: MediaKind.collection));
|
||||
expect(params['IncludeItemTypes'], 'BoxSet');
|
||||
|
||||
Reference in New Issue
Block a user