Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Prev Previous commit
Next Next commit
Add missing unit tests
  • Loading branch information
Sebastian Roth committed Aug 20, 2019
commit 72a943bb9338bd69733411ace4c82ec32799235c
40 changes: 37 additions & 3 deletions packages/path_provider/test/path_provider_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -33,29 +33,63 @@ void main() {
expect(directory, isNull);
});

test('getApplicationDocumentsDirectory test', () async {
test('getApplicationSupportDirectory test', () async {
response = null;
final Directory directory = await getApplicationDocumentsDirectory();
final Directory directory = await getApplicationSupportDirectory();
expect(
log,
<Matcher>[
isMethodCall('getApplicationDocumentsDirectory', arguments: null)
isMethodCall('getApplicationSupportDirectory', arguments: null)
],
);
expect(directory, isNull);
});

test('getApplicationDocumentsDirectory test', () async {
response = null;
final Directory directory = await getApplicationDocumentsDirectory();
expect(
log,
<Matcher>[isMethodCall('getApplicationDocumentsDirectory', arguments: null)],
);
expect(directory, isNull);
});

test('getExternalStorageDirectory test', () async {
response = null;
final Directory directory = await getExternalStorageDirectory();
expect(
log,
<Matcher>[isMethodCall('getStorageDirectory', arguments: null)],
);
expect(directory, isNull);
});

test('TemporaryDirectory path test', () async {
final String fakePath = "/foo/bar/baz";
response = fakePath;
final Directory directory = await getTemporaryDirectory();
expect(directory.path, equals(fakePath));
});

test('ApplicationSupportDirectory path test', () async {
final String fakePath = "/foo/bar/baz";
response = fakePath;
final Directory directory = await getApplicationSupportDirectory();
expect(directory.path, equals(fakePath));
});

test('ApplicationDocumentsDirectory path test', () async {
final String fakePath = "/foo/bar/baz";
response = fakePath;
final Directory directory = await getApplicationDocumentsDirectory();
expect(directory.path, equals(fakePath));
});

test('ExternalStorageDirectory path test', () async {
final String fakePath = "/foo/bar/baz";
response = fakePath;
final Directory directory = await getExternalStorageDirectory();
expect(directory.path, equals(fakePath));
});
}