85183c455a
Drops the libsqlite3-missing skip cohort now that the ci-flutter runner image installs libsqlite3-0 (CI-runner commit on its main). Per-file removals (no behavior change in tests themselves — they just stop being skipped): - `@Tags(['drift'])` + `library;` directive from 5 files. - `const _skipDrift = ...;` declaration + its rationale comment from 6 files (the 5 above + like_button_test.dart, which had its own _skipDrift for the rollback-via-drift case). - `skip: _skipDrift` annotations from 17 test invocations across those 6 files (16 single-line + 1 multi-line in like_button). - Stale `@Tags(['drift']) tier covers it` reference in home_screen_test.dart's drift-coverage comment. Net -79 +18 lines across 7 files; 17 previously-silent tests are now part of the CI signal. Fable #399. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
109 lines
4.1 KiB
Dart
109 lines
4.1 KiB
Dart
import 'package:flutter/material.dart';
|
|
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
|
|
import 'package:minstrel/api/endpoints/playlists.dart';
|
|
import 'package:minstrel/library/home_screen.dart';
|
|
import 'package:minstrel/library/library_providers.dart';
|
|
import 'package:minstrel/models/home_index.dart';
|
|
import 'package:minstrel/models/playlist.dart';
|
|
import 'package:minstrel/models/system_playlists_status.dart';
|
|
import 'package:minstrel/playlists/playlists_provider.dart';
|
|
import 'package:minstrel/theme/theme_data.dart';
|
|
|
|
// All tests pump an empty HomeIndex unless they care about populated
|
|
// section IDs — per-tile hydration is intentionally not exercised here.
|
|
// What this suite verifies is the screen's section-level shape:
|
|
// placeholders / empty-state copy / section presence given the index.
|
|
const _emptyIndex = HomeIndex.empty;
|
|
|
|
void main() {
|
|
testWidgets('renders 4 placeholder cards in Playlists row when no system playlists exist',
|
|
(tester) async {
|
|
await tester.pumpWidget(ProviderScope(
|
|
overrides: [
|
|
homeIndexProvider.overrideWith((ref) => Stream.value(_emptyIndex)),
|
|
playlistsListProvider('all').overrideWith(
|
|
(ref) => Stream.value(PlaylistsList.empty()),
|
|
),
|
|
systemPlaylistsStatusProvider.overrideWith(
|
|
(ref) => Stream.value(SystemPlaylistsStatus.empty()),
|
|
),
|
|
],
|
|
child: MaterialApp(theme: buildThemeData(), home: const HomeScreen()),
|
|
));
|
|
await tester.pumpAndSettle();
|
|
// For-You placeholder + Discover placeholder + 3 Songs-like placeholders.
|
|
expect(find.text('For You'), findsOneWidget);
|
|
expect(find.text('Discover'), findsOneWidget);
|
|
expect(find.text('Songs like…'), findsNWidgets(3));
|
|
});
|
|
|
|
testWidgets('renders empty-state copy for each section when the index is empty',
|
|
(tester) async {
|
|
await tester.pumpWidget(ProviderScope(
|
|
overrides: [
|
|
homeIndexProvider.overrideWith((ref) => Stream.value(_emptyIndex)),
|
|
playlistsListProvider('all').overrideWith(
|
|
(ref) => Stream.value(PlaylistsList.empty()),
|
|
),
|
|
systemPlaylistsStatusProvider.overrideWith(
|
|
(ref) => Stream.value(SystemPlaylistsStatus.empty()),
|
|
),
|
|
],
|
|
child: MaterialApp(theme: buildThemeData(), home: const HomeScreen()),
|
|
));
|
|
await tester.pumpAndSettle();
|
|
expect(
|
|
find.text("Nothing added yet. Scan a folder via the server's config."),
|
|
findsOneWidget,
|
|
);
|
|
expect(
|
|
find.text('No forgotten favourites yet. Like some albums or artists to fill this in.'),
|
|
findsOneWidget,
|
|
);
|
|
expect(find.text('No plays to draw from. Listen to something.'),
|
|
findsOneWidget);
|
|
expect(find.text('No recent plays.'), findsOneWidget);
|
|
});
|
|
|
|
testWidgets('renders For-You card when system playlist exists',
|
|
(tester) async {
|
|
const forYou = Playlist(
|
|
id: 'fy',
|
|
userId: 'u1',
|
|
name: 'For You',
|
|
description: '',
|
|
isPublic: false,
|
|
systemVariant: 'for_you',
|
|
trackCount: 75,
|
|
coverUrl: '',
|
|
ownerUsername: 'alice',
|
|
createdAt: '2026-05-01T00:00:00Z',
|
|
updatedAt: '2026-05-01T00:00:00Z',
|
|
);
|
|
await tester.pumpWidget(ProviderScope(
|
|
overrides: [
|
|
homeIndexProvider.overrideWith((ref) => Stream.value(_emptyIndex)),
|
|
playlistsListProvider('all').overrideWith(
|
|
(ref) => Stream.value(
|
|
const PlaylistsList(owned: [forYou], public: [])),
|
|
),
|
|
systemPlaylistsStatusProvider.overrideWith(
|
|
(ref) => Stream.value(SystemPlaylistsStatus.empty()),
|
|
),
|
|
],
|
|
child: MaterialApp(theme: buildThemeData(), home: const HomeScreen()),
|
|
));
|
|
await tester.pumpAndSettle();
|
|
// The real card carries the playlist name + the "for you" badge.
|
|
expect(find.text('For You'), findsOneWidget);
|
|
expect(find.text('for you'), findsOneWidget);
|
|
});
|
|
|
|
// Section-with-populated-IDs coverage lives in the drift-tagged
|
|
// integration suite (Slice F follow-up) because per-tile providers
|
|
// require a real (in-memory) drift DB. The flutter-ci runner skips
|
|
// drift tests pending libsqlite3.
|
|
}
|