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,42 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:marianum_mobile/api/marianumcloud/files_sharing/ocs_path.dart';
|
||||
import 'package:marianum_mobile/api/marianumcloud/webdav/queries/list_files/cacheable_file.dart';
|
||||
|
||||
void main() {
|
||||
group('ocsPathFor', () {
|
||||
test('files root maps to a single slash', () {
|
||||
expect(ocsPathFor(''), '/');
|
||||
expect(ocsPathFor('/'), '/');
|
||||
});
|
||||
|
||||
test('a file path gets a leading slash', () {
|
||||
expect(ocsPathFor('Documents/x.pdf'), '/Documents/x.pdf');
|
||||
});
|
||||
|
||||
test('a folder loses its trailing slash', () {
|
||||
expect(ocsPathFor('Documents/'), '/Documents');
|
||||
expect(ocsPathFor('Shared/a/'), '/Shared/a');
|
||||
});
|
||||
|
||||
test('collapses leading/trailing slashes', () {
|
||||
expect(ocsPathFor('/Shared/a/'), '/Shared/a');
|
||||
});
|
||||
});
|
||||
|
||||
group('ocsPathOf', () {
|
||||
test('derives from a CacheableFile path', () {
|
||||
final folder = CacheableFile(
|
||||
path: 'Documents/',
|
||||
isDirectory: true,
|
||||
name: 'Documents',
|
||||
);
|
||||
final file = CacheableFile(
|
||||
path: 'Documents/report.pdf',
|
||||
isDirectory: false,
|
||||
name: 'report.pdf',
|
||||
);
|
||||
expect(ocsPathOf(folder), '/Documents');
|
||||
expect(ocsPathOf(file), '/Documents/report.pdf');
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user