initTestDir function

Future<Directory> initTestDir()

Initializes a test directory

Implementation

Future<Directory> initTestDir() async {
  final tmpBase = await Directory('/tmp').exists()
      ? Directory('/tmp')
      : Directory.systemTemp;

  final tmp = await tmpBase.createTemp('gg_git_test');

  final testDir = Directory('${tmp.path}/test');
  if (await testDir.exists()) {
    await testDir.delete(recursive: true);
  }
  await testDir.create(recursive: true);

  return testDir;
}