import 'dart:convert'; import 'dart:io'; import 'package:path/path.dart' as p; /// Utility that reads JSON fixtures from `test/fixtures`. /// /// Using files instead of inline maps makes it explicit which payloads /// are exchanged with the backend. class FixtureReader { const FixtureReader._(); static String readAsString(String relativePath) { final file = File(_resolve(relativePath)); return file.readAsStringSync(); } static Map readAsMap(String relativePath) { return jsonDecode(readAsString(relativePath)) as Map; } static List readAsList(String relativePath) { return jsonDecode(readAsString(relativePath)) as List; } static String _resolve(String relativePath) { return p.normalize(p.join('test', 'fixtures', relativePath)); } }