test(reference): add tests for symbolic refs

This commit is contained in:
Aleksey Kulikov 2021-08-04 16:11:29 +03:00
parent 2f896e6180
commit 6643527f2d
3 changed files with 40 additions and 8 deletions

View file

@ -33,6 +33,10 @@ void main() {
test('returns correct type of reference', () {
expect(repo.head.type, ReferenceType.direct);
repo.head.free();
final ref = Reference.lookup(repo, 'HEAD');
expect(ref.type, ReferenceType.symbolic);
ref.free();
});
test('returns SHA hex of direct reference', () {
@ -40,6 +44,12 @@ void main() {
repo.head.free();
});
test('returns SHA hex of symbolic reference', () {
final ref = Reference.lookup(repo, 'HEAD');
expect(ref.target, lastCommit);
ref.free();
});
test('returns the full name of a reference', () {
expect(repo.head.name, 'refs/heads/master');
repo.head.free();