feat(repository): add extended options to repository init

This commit is contained in:
Aleksey Kulikov 2021-09-24 13:18:04 +03:00
parent ec8ff24e89
commit b1f112a30d
4 changed files with 155 additions and 11 deletions

View file

@ -20,16 +20,36 @@ void main() {
});
group('Repository.init', () {
test('successfully creates new bare repo at provided path', () {
repo = Repository.init(initDir.path, isBare: true);
repo = Repository.init(path: initDir.path, bare: true);
expect(repo.path, '${initDir.path}/');
expect(repo.isBare, true);
});
test('successfully creates new standard repo at provided path', () {
repo = Repository.init(initDir.path);
repo = Repository.init(path: initDir.path);
expect(repo.path, '${initDir.path}/.git/');
expect(repo.isBare, false);
expect(repo.isEmpty, true);
});
test('successfully creates new standard repo with provided options', () {
repo = Repository.init(
path: initDir.path,
description: 'test repo',
originUrl: 'test.url',
flags: {GitRepositoryInit.mkdir, GitRepositoryInit.mkpath},
);
expect(repo.path, '${initDir.path}/.git/');
expect(repo.isBare, false);
expect(repo.isEmpty, true);
expect(
File('${initDir.path}/.git/description').readAsStringSync(),
'test repo',
);
expect(repo.remotes['origin'].url, 'test.url');
});
});
}