import 'package:flutter_test/flutter_test.dart';
import 'package:smplayer/core/contracts/library.dart';
import 'package:smplayer/features/detail/model/selected_episode_merge.dart';

void main() {
  group('applyPlaybackReturnProgress', () {
    test('overrides stale playback position', () {
      const item = EmbyRawItem(
        Id: 'ep1',
        Name: 'Episode 1',
        UserData: EmbyRawUserData(PlaybackPositionTicks: 10),
      );

      final updated = applyPlaybackReturnProgress(item, 500);

      expect(updated.UserData?.PlaybackPositionTicks, 500);
    });

    test('creates UserData when detail has none', () {
      const item = EmbyRawItem(Id: 'movie1', Name: 'Movie 1');

      final updated = applyPlaybackReturnProgress(item, 300);

      expect(updated.UserData?.PlaybackPositionTicks, 300);
    });
  });
}
