import 'package:flutter_test/flutter_test.dart';
import 'package:smplayer/core/contracts/trakt/trakt_sync_job.dart';

void main() {
  test('旧队列 JSON 的冗余字段可忽略且调度字段保留', () {
    final job = TraktSyncJob.fromJson({
      'id': 'job-1',
      'type': 'scrobble_pause',
      'body': {
        'movie': {'title': 'Demo'},
      },
      'progress': 42.0,
      'createdAt': '2026-01-01T00:00:00Z',
      'updatedAt': '2026-01-02T00:00:00Z',
      'lastError': 'transient',
      'retryCount': 3,
      'nextRetryAt': '2026-01-03T00:00:00Z',
      'exhausted': false,
    });

    expect(job.type, TraktSyncJobType.scrobblePause);
    expect(job.retryCount, 3);
    expect(job.nextRetryAt, DateTime.utc(2026, 1, 3));
    expect(job.toJson(), isNot(contains('progress')));
    expect(job.toJson(), isNot(contains('lastError')));
  });
}
