import 'package:flutter/material.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_test/flutter_test.dart';

import 'package:minstrel/library/widgets/compact_track_card.dart';
import 'package:minstrel/models/track.dart';
import 'package:minstrel/theme/theme_data.dart';

const _track = TrackRef(
  id: 't1',
  title: 'Roygbiv',
  albumId: 'a1',
  albumTitle: 'Geogaddi',
  artistId: 'ar1',
  artistName: 'Boards of Canada',
  durationSec: 137,
  trackNumber: 4,
  streamUrl: '',
);

void main() {
  testWidgets('renders title and artist', (tester) async {
    await tester.pumpWidget(ProviderScope(
      child: MaterialApp(
        theme: buildThemeData(),
        home: const Scaffold(
          body: CompactTrackCard(
            track: _track,
            sectionTracks: [_track],
            index: 0,
          ),
        ),
      ),
    ));
    expect(find.text('Roygbiv'), findsOneWidget);
    expect(find.text('Boards of Canada'), findsOneWidget);
  });
}
