Skip to content

Commit

Permalink
chore: fix tests to return a future in the teardown
Browse files Browse the repository at this point in the history
  • Loading branch information
khatruong2009 committed Apr 10, 2024
1 parent e18d27e commit cba7895
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ void main() {
bytesPath = 'public/download-data-${uuid()}';
bytesData = 'test data'.codeUnits;
addTearDown(
() => Amplify.Storage.remove(path: StoragePath.fromString(bytesPath)),
() => Amplify.Storage.remove(path: StoragePath.fromString(bytesPath)).result,
);

bytesUploadResult = await Amplify.Storage.uploadData(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ void main() {
path: StoragePath.fromString(filePath),
).result;
addTearDown(
() => Amplify.Storage.remove(path: StoragePath.fromString(filePath)),
() => Amplify.Storage.remove(path: StoragePath.fromString(filePath)).result,
);
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ void main() {
late List<String> uploadedPaths;

setUpAll(() async {
await configure(amplifyEnvironments['key']!);
await configure(amplifyEnvironments['main']!);

uniquePrefix = 'public/test-list-${uuid()}/';
uploadedPaths = [
Expand All @@ -35,7 +35,7 @@ void main() {

addTearDown(() async {
for (final path in uploadedPaths) {
Amplify.Storage.remove(path: StoragePath.fromString(path));
await Amplify.Storage.remove(path: StoragePath.fromString(path)).result;
}
});
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import 'download_data_test.dart' as download_data_tests;
import 'download_file_test.dart' as download_file_tests;
import 'issues/get_url_special_characters_test.dart'
as get_url_special_characters_tests;
import 'list_test.dart' as list_tests;
import 'use_case_test.dart' as use_case_tests;

void main() {
Expand All @@ -18,5 +19,6 @@ void main() {
use_case_tests.main();
download_data_tests.main();
download_file_tests.main();
list_tests.main();
});
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,7 @@ Future<void> configure(String config) async {

await Amplify.addPlugins([authPlugin, storagePlugin]);
await Amplify.configure(config);
addTearDown(Amplify.reset);
addTearDown(() {
return Amplify.reset();
});
}

0 comments on commit cba7895

Please sign in to comment.