halkyon/halkyon_learn_flutter/test/support/fake_about_gateway.dart

19 lines
602 B
Dart
Raw Normal View History

import 'package:halkyon_learn_flutter/src/feature/about/data/about_gateway.dart';
/// An [AboutGateway] without a server, naming [sourceCodeUrl]; [unreachable]
/// makes it fail as when the instance can't be reached.
class FakeAboutGateway({
/// Where the instance says its source is.
final String sourceCodeUrl = 'https://example.org/halkyon-learn',
}) implements AboutGateway {
/// Thrown by the next calls while set.
Exception? unreachable;
@override
Future<String> sourceCode() async {
if (unreachable case final error?) {
throw error;
}
return sourceCodeUrl;
}
}