mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-04 20:29:08 -04:00
feat(commit): add base bindings and api
This commit is contained in:
parent
696d55bb3a
commit
dc5f510aa5
12 changed files with 485 additions and 17 deletions
63
test/signature_test.dart
Normal file
63
test/signature_test.dart
Normal file
|
@ -0,0 +1,63 @@
|
|||
import 'package:test/test.dart';
|
||||
import 'package:libgit2dart/libgit2dart.dart';
|
||||
|
||||
void main() {
|
||||
late Signature signature;
|
||||
group('Signature', () {
|
||||
const name = 'Some Name';
|
||||
const email = 'some@email.com';
|
||||
const time = 1234567890;
|
||||
const offset = 0;
|
||||
|
||||
setUp(() {
|
||||
signature = Signature.create(
|
||||
name: name,
|
||||
email: email,
|
||||
time: time,
|
||||
offset: offset,
|
||||
);
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
signature.free();
|
||||
});
|
||||
|
||||
test('successfully creates with provided time and offset', () {
|
||||
expect(signature, isA<Signature>());
|
||||
});
|
||||
|
||||
test('successfully creates without provided time and offset', () {
|
||||
final defaultSignature =
|
||||
Signature.create(name: 'Name', email: 'email@example.com');
|
||||
expect(defaultSignature, isA<Signature>());
|
||||
expect(defaultSignature.name, 'Name');
|
||||
expect(defaultSignature.email, 'email@example.com');
|
||||
expect(
|
||||
defaultSignature.time -
|
||||
(DateTime.now().millisecondsSinceEpoch / 1000).truncate(),
|
||||
lessThan(5),
|
||||
);
|
||||
expect(defaultSignature.offset, 180);
|
||||
defaultSignature.free();
|
||||
});
|
||||
|
||||
test('returns correct values', () {
|
||||
expect(signature.name, name);
|
||||
expect(signature.email, email);
|
||||
expect(signature.time, time);
|
||||
expect(signature.offset, offset);
|
||||
});
|
||||
|
||||
test('compares two objects', () {
|
||||
final otherSignature = Signature.create(
|
||||
name: name,
|
||||
email: email,
|
||||
time: time,
|
||||
offset: offset,
|
||||
);
|
||||
expect(signature == otherSignature, true);
|
||||
|
||||
otherSignature.free();
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue