implemented a comprehensive Nextcloud file sharing system with support for user, group, and public link shares with gating based on server-side permissions; added sharing management interfaces including a share sheet; updated the file list with visual badges for incoming shares and improved OCS API response handling.
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:marianum_mobile/api/marianumcloud/webdav/queries/list_files/cacheable_file.dart';
|
||||
import 'package:marianum_mobile/api/marianumcloud/webdav/queries/list_files/list_files_response.dart';
|
||||
|
||||
void main() {
|
||||
group('ListFilesResponse cache round-trip', () {
|
||||
test('isSharedWithMe survives jsonEncode -> decode -> fromJson', () {
|
||||
final response = ListFilesResponse({
|
||||
CacheableFile(
|
||||
path: 'Shared/',
|
||||
isDirectory: true,
|
||||
name: 'Shared',
|
||||
isSharedWithMe: true,
|
||||
),
|
||||
CacheableFile(
|
||||
path: 'own.txt',
|
||||
isDirectory: false,
|
||||
name: 'own.txt',
|
||||
),
|
||||
});
|
||||
|
||||
// Mirror exactly what RequestCache does: jsonEncode the response, then
|
||||
// read it back through fromJson.
|
||||
final encoded = jsonEncode(response);
|
||||
final decoded = ListFilesResponse.fromJson(
|
||||
jsonDecode(encoded) as Map<String, dynamic>,
|
||||
);
|
||||
|
||||
final shared = decoded.files.firstWhere((f) => f.name == 'Shared');
|
||||
final own = decoded.files.firstWhere((f) => f.name == 'own.txt');
|
||||
|
||||
expect(shared.isSharedWithMe, isTrue);
|
||||
expect(own.isSharedWithMe, isNull);
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user