import 'package:block_seasons/data/remote/manifest.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { final json = { 'schemaVersion': 1, 'minAppBuild': 1, 'current': 'season_002', 'seasons': [ { 'seasonId': 'season_001', 'version': 1, 'packUrl': 'seasons/season_001/pack.json', 'sha256': 'abc123', }, { 'seasonId': 'season_002', 'version': 3, 'packUrl': 'seasons/season_002/pack.json', 'sha256': 'def456', }, ], }; test('round-trips through json', () { final manifest = RemoteManifest.fromJson(json); expect(manifest.schemaVersion, 1); expect(manifest.minAppBuild, 1); expect(manifest.current, 'season_002'); expect(manifest.seasons, hasLength(2)); expect(manifest.seasons[1].seasonId, 'season_002'); expect(manifest.seasons[1].version, 3); expect(manifest.seasons[1].packUrl, 'seasons/season_002/pack.json'); expect(manifest.seasons[1].sha256, 'def456'); expect(RemoteManifest.fromJson(manifest.toJson()).toJson(), manifest.toJson()); }); test('rejects unsupported schema', () { expect( () => RemoteManifest.fromJson({...json, 'schemaVersion': 99}), throwsFormatException, ); }); test('missing current falls back to last season id', () { final m = RemoteManifest.fromJson({...json}..remove('current')); expect(m.current, 'season_002'); }); }