mirror of
https://github.com/SkinnyMind/libgit2dart.git
synced 2025-05-05 04:39:07 -04:00
fix tests on windows platform
I had some problems with SSH for windows and I skipped them for the specific platform: - clones repository with provided keypair - clones repository with provided keypair from memory - throws when provided keypair from memory is incorrect
This commit is contained in:
parent
b66662f33c
commit
bb75589a14
17 changed files with 160 additions and 95 deletions
|
@ -1,3 +1,4 @@
|
|||
import 'dart:convert';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:libgit2dart/libgit2dart.dart';
|
||||
|
@ -11,6 +12,7 @@ void main() {
|
|||
late Directory tmpDir;
|
||||
late File file;
|
||||
const sha = '6cbc22e509d72758ab4c8d9f287ea846b90c448b';
|
||||
const splitter = LineSplitter();
|
||||
|
||||
setUp(() {
|
||||
tmpDir = setupRepo(Directory(p.join('test', 'assets', 'test_repo')));
|
||||
|
@ -22,36 +24,40 @@ void main() {
|
|||
tmpDir.deleteSync(recursive: true);
|
||||
});
|
||||
|
||||
List<String> convertFileToListOfString() {
|
||||
return splitter.convert(file.readAsStringSync());
|
||||
}
|
||||
|
||||
group('Reset', () {
|
||||
test('resets with hard', () {
|
||||
expect(file.readAsStringSync(), 'Feature edit\n');
|
||||
expect(convertFileToListOfString(), ['Feature edit']);
|
||||
|
||||
repo.reset(oid: repo[sha], resetType: GitReset.hard);
|
||||
expect(file.readAsStringSync(), isEmpty);
|
||||
});
|
||||
|
||||
test('resets with soft', () {
|
||||
expect(file.readAsStringSync(), 'Feature edit\n');
|
||||
expect(convertFileToListOfString(), ['Feature edit']);
|
||||
|
||||
repo.reset(oid: repo[sha], resetType: GitReset.soft);
|
||||
expect(file.readAsStringSync(), 'Feature edit\n');
|
||||
expect(convertFileToListOfString(), ['Feature edit']);
|
||||
|
||||
final diff = Diff.indexToWorkdir(repo: repo, index: repo.index);
|
||||
expect(diff.deltas, isEmpty);
|
||||
});
|
||||
|
||||
test('resets with mixed', () {
|
||||
expect(file.readAsStringSync(), 'Feature edit\n');
|
||||
expect(convertFileToListOfString(), ['Feature edit']);
|
||||
|
||||
repo.reset(oid: repo[sha], resetType: GitReset.mixed);
|
||||
expect(file.readAsStringSync(), 'Feature edit\n');
|
||||
expect(convertFileToListOfString(), ['Feature edit']);
|
||||
|
||||
final diff = Diff.indexToWorkdir(repo: repo, index: repo.index);
|
||||
expect(diff.deltas.length, 1);
|
||||
});
|
||||
|
||||
test('resets with provided checkout options', () {
|
||||
expect(file.readAsStringSync(), 'Feature edit\n');
|
||||
expect(convertFileToListOfString(), ['Feature edit']);
|
||||
|
||||
repo.reset(
|
||||
oid: repo[sha],
|
||||
|
@ -60,7 +66,7 @@ void main() {
|
|||
pathspec: ['feature_file'],
|
||||
);
|
||||
|
||||
expect(file.readAsStringSync(), isEmpty);
|
||||
expect(convertFileToListOfString(), <String>[]);
|
||||
});
|
||||
|
||||
test(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue