mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
test: add document sync test on appflowy cloud (#4163)
* test: add document sync test on appflowy cloud * chore: add runner * test: Stream has already been listened to. * fix: using singleton subscription * fix: using singleton subscription
This commit is contained in:
30
frontend/appflowy_flutter/integration_test/util/dir.dart
Normal file
30
frontend/appflowy_flutter/integration_test/util/dir.dart
Normal file
@ -0,0 +1,30 @@
|
||||
import 'dart:io';
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
Future<void> deleteDirectoriesWithSameBaseNameAsPrefix(
|
||||
String path,
|
||||
) async {
|
||||
final dir = Directory(path);
|
||||
final prefix = p.basename(dir.path);
|
||||
final parentDir = dir.parent;
|
||||
|
||||
// Check if the directory exists
|
||||
if (!await parentDir.exists()) {
|
||||
// ignore: avoid_print
|
||||
print('Directory does not exist');
|
||||
return;
|
||||
}
|
||||
|
||||
// List all entities in the directory
|
||||
await for (final entity in parentDir.list()) {
|
||||
// Check if the entity is a directory and starts with the specified prefix
|
||||
if (entity is Directory && p.basename(entity.path).startsWith(prefix)) {
|
||||
try {
|
||||
await entity.delete(recursive: true);
|
||||
} catch (e) {
|
||||
// ignore: avoid_print
|
||||
print('Failed to delete directory: ${entity.path}, Error: $e');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user