mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
feat(reference): add ability to create direct reference
This commit is contained in:
parent
6643527f2d
commit
9190ed2e0f
16 changed files with 669 additions and 60 deletions
56
test/reflog_test.dart
Normal file
56
test/reflog_test.dart
Normal file
|
@ -0,0 +1,56 @@
|
|||
import 'dart:io';
|
||||
|
||||
import 'package:test/test.dart';
|
||||
import 'package:libgit2dart/src/repository.dart';
|
||||
import 'package:libgit2dart/src/reflog.dart';
|
||||
|
||||
import 'helpers/util.dart';
|
||||
|
||||
void main() {
|
||||
group('RefLog', () {
|
||||
late final Repository repo;
|
||||
late final RefLog reflog;
|
||||
final tmpDir = '${Directory.systemTemp.path}/reflog_testrepo/';
|
||||
|
||||
setUpAll(() async {
|
||||
if (await Directory(tmpDir).exists()) {
|
||||
await Directory(tmpDir).delete(recursive: true);
|
||||
}
|
||||
await copyRepo(
|
||||
from: Directory('test/assets/testrepo/'),
|
||||
to: await Directory(tmpDir).create(),
|
||||
);
|
||||
repo = Repository.open(tmpDir);
|
||||
reflog = RefLog(repo.head);
|
||||
});
|
||||
|
||||
tearDownAll(() async {
|
||||
repo.head.free();
|
||||
reflog.free();
|
||||
repo.close();
|
||||
await Directory(tmpDir).delete(recursive: true);
|
||||
});
|
||||
|
||||
test('initializes successfully', () {
|
||||
expect(reflog, isA<RefLog>());
|
||||
});
|
||||
|
||||
test('returns correct number of log entries', () {
|
||||
expect(reflog.count, 3);
|
||||
});
|
||||
|
||||
test('returns the log message', () {
|
||||
final entry = reflog.entryAt(0);
|
||||
expect(
|
||||
entry.message,
|
||||
"merge feature: Merge made by the 'recursive' strategy.",
|
||||
);
|
||||
});
|
||||
|
||||
test('returns the committer of the entry', () {
|
||||
final entry = reflog.entryAt(0);
|
||||
expect(entry.committer['name'], 'Aleksey Kulikov');
|
||||
expect(entry.committer['email'], 'skinny.mind@gmail.com');
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue