onedirve and google drive
This commit is contained in:
parent
a9bcec09b1
commit
901ec678a3
12 changed files with 373 additions and 29 deletions
|
|
@ -89,6 +89,31 @@ void main() {
|
|||
'app-folder-id/$receiptsFolderName/1FMPU18L1TLB51349/2026.03');
|
||||
});
|
||||
|
||||
test('selectAppFolder creates/finds the app folder under the picked parent', () async {
|
||||
final session = _FakeSession();
|
||||
final provider = _FakeProvider(session);
|
||||
final syncService = CloudSyncService(provider: provider, databaseService: databaseService);
|
||||
|
||||
final folderId = await syncService.selectAppFolder('parent-id');
|
||||
|
||||
expect(folderId, 'parent-id/$appFolderName');
|
||||
expect(session.findOrCreateFolderCalls, ['parent-id/$appFolderName']);
|
||||
});
|
||||
|
||||
test('selectAppFolder uses the picked folder directly if it is already the app folder',
|
||||
() async {
|
||||
final session = _FakeSession();
|
||||
final provider = _FakeProvider(session);
|
||||
final syncService = CloudSyncService(provider: provider, databaseService: databaseService);
|
||||
|
||||
final folderId =
|
||||
await syncService.selectAppFolder('parent-id/$appFolderName', currentFolderName: appFolderName);
|
||||
|
||||
expect(folderId, 'parent-id/$appFolderName');
|
||||
expect(session.findOrCreateFolderCalls, isEmpty,
|
||||
reason: 'should not nest another app folder inside a folder already named that');
|
||||
});
|
||||
|
||||
test('syncNow is a no-op when not configured with a folder yet', () async {
|
||||
final session = _FakeSession();
|
||||
final provider = _FakeProvider(session);
|
||||
|
|
@ -117,6 +142,7 @@ class _FakeSession implements CloudStorageSession {
|
|||
final List<String> deletedFileIds = [];
|
||||
final List<String> uploadedFileNames = [];
|
||||
final Map<String, String> uploadedFileFolders = {};
|
||||
final List<String> findOrCreateFolderCalls = [];
|
||||
CloudFileInfo? existingDataFile;
|
||||
|
||||
@override
|
||||
|
|
@ -126,8 +152,10 @@ class _FakeSession implements CloudStorageSession {
|
|||
Future<List<CloudFolder>> listFolders({String? parentId, bool sharedWithMe = false}) async => [];
|
||||
|
||||
@override
|
||||
Future<String> findOrCreateFolder({required String parentId, required String name}) async =>
|
||||
'$parentId/$name';
|
||||
Future<String> findOrCreateFolder({required String parentId, required String name}) async {
|
||||
findOrCreateFolderCalls.add('$parentId/$name');
|
||||
return '$parentId/$name';
|
||||
}
|
||||
|
||||
@override
|
||||
Future<CloudFileInfo?> findFile({required String folderId, required String name}) async {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue