test: improve coverage

This commit is contained in:
Aleksey Kulikov 2021-10-15 17:37:38 +03:00
parent d75acbfdd3
commit d6eae1e9ed
71 changed files with 710 additions and 229 deletions

View file

@ -26,6 +26,7 @@ void main() {
group('Tree', () {
test('successfully initializes tree from provided Oid', () {
expect(tree, isA<Tree>());
expect(tree.toString(), contains('Tree{'));
});
test('returns correct values', () {
@ -55,6 +56,7 @@ void main() {
test('returns tree entry with provided path to file', () {
final entry = tree['dir/dir_file.txt'];
expect(entry.oid.sha, 'e69de29bb2d1d6434b8b29ae775ad8c2e48c5391');
expect(entry.toString(), contains('TreeEntry{'));
entry.free();
});
@ -62,6 +64,10 @@ void main() {
expect(() => tree['invalid/path'], throwsA(isA<LibGit2Error>()));
});
test('throws when looking up with invalid argument type', () {
expect(() => tree[true], throwsA(isA<ArgumentError>()));
});
test('successfully creates tree', () {
final fileOid = repo.createBlob('blob content');
final builder = TreeBuilder(repo: repo);