fix(runtime): harden application service boundaries

This commit is contained in:
edde746
2026-07-24 03:46:46 +02:00
parent 658da37b48
commit e0bf66eea8
309 changed files with 32574 additions and 4369 deletions
+31 -8
View File
@@ -17,17 +17,39 @@ void main() {
expect(liveTvChannelScopeKey(a), isNot(liveTvChannelScopeKey(b)));
});
test('favorite filtering falls back to all channels when no favorites are loaded', () {
test('favorite filtering distinguishes disabled, loading, and loaded-empty states', () {
final channels = [LiveTvChannel(key: '101'), LiveTvChannel(key: '102')];
final filtered = filterLiveTvChannelsForFavorites(
channels: channels,
favoritesOnly: true,
favorites: const [],
sourceForChannel: (_) => 'server://server-1/provider-a',
expect(
filterLiveTvChannelsForFavorites(
channels: channels,
favoritesOnly: false,
favoritesLoaded: true,
favorites: const [],
sourceForChannel: (_) => 'server://server-1/provider-a',
),
same(channels),
);
expect(
filterLiveTvChannelsForFavorites(
channels: channels,
favoritesOnly: true,
favoritesLoaded: false,
favorites: const [],
sourceForChannel: (_) => 'server://server-1/provider-a',
),
same(channels),
);
expect(
filterLiveTvChannelsForFavorites(
channels: channels,
favoritesOnly: true,
favoritesLoaded: true,
favorites: const [],
sourceForChannel: (_) => 'server://server-1/provider-a',
),
isEmpty,
);
expect(filtered, same(channels));
});
test('favorite filtering preserves favorite order and source scope', () {
@@ -38,6 +60,7 @@ void main() {
final filtered = filterLiveTvChannelsForFavorites(
channels: channels,
favoritesOnly: true,
favoritesLoaded: true,
favorites: [
FavoriteChannel(source: sourceB, id: '101'),
FavoriteChannel(source: sourceA, id: '102'),