blob: ffec2b5c3ae09874808ddf3adbb3e8163529df70 [file] [log] [blame]
import 'package:fxutils/fxutils.dart';
import 'package:path/path.dart' as p;
/// Convenience class for tests which returns values vaguely of the same
/// structure as real values, but never suitable for any actual work. This can
/// only safely be used by tests making sure they *would* do work correctly,
/// without having to repeatedly instantiate the same fakes over and over.
class FakeFxEnv extends IFxEnv {
final String _cwd;
final String _fuchsiaDir;
final EnvReader? _envReader;
String fuchsiaDir = '/root/fuchsia',
String cwd = '/cwd',
EnvReader? envReader,
}) : _envReader = envReader,
_fuchsiaDir = fuchsiaDir,
_cwd = cwd;
static final FakeFxEnv shared = FakeFxEnv();
String get cwd => _cwd;
String get fuchsiaArch => 'x86';
String get fuchsiaDir => _fuchsiaDir;
String get hostOutDir => p.join(fuchsiaDir, 'out/default/host_$fuchsiaArch');
String get outputDir => p.join(fuchsiaDir, 'out/default');
String get sshKey => p.join(fuchsiaDir, 'out/default/.ssh/pkey');
String? getEnv(String variableName, [String? defaultValue]) =>
_envReader?.getEnv(variableName, defaultValue);