mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-11-28 23:25:52 +01:00
Rename the Dart package, Android and iOS identifiers, Rust crates, native libraries, and Discord plugin. Preserve legacy data readers and compatibility aliases. Update localized branding, documentation, artwork, build tooling, and release artifacts. Route Telegram release notifications to @mornyeupdates and link @mornyecommunity.
38 lines
1.3 KiB
Dart
38 lines
1.3 KiB
Dart
import 'package:flutter/services.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:mornye/services/file_access_check.dart';
|
|
import 'package:mornye/utils/file_access.dart';
|
|
|
|
void main() {
|
|
test('found files retain their size and modification time', () async {
|
|
final stat = FileAccessStat(size: 123, modified: DateTime(2026));
|
|
final result = await checkFileAccess(
|
|
'/music/track.flac',
|
|
readStat: (_) async => stat,
|
|
);
|
|
expect(result, isA<FileAccessFound>());
|
|
expect((result as FileAccessFound).stat, same(stat));
|
|
});
|
|
|
|
test('only a confirmed absent file is missing', () async {
|
|
final result = await checkFileAccess(
|
|
'/music/removed.flac',
|
|
readStat: (_) async => null,
|
|
);
|
|
expect(result, isA<FileAccessMissing>());
|
|
});
|
|
|
|
for (final code in ['permission_denied', 'provider_unavailable']) {
|
|
test('$code is unavailable and retains its diagnostic', () async {
|
|
final error = PlatformException(code: code);
|
|
final result = await checkFileAccess(
|
|
'content://provider/music/track.flac',
|
|
readStat: (_) async => throw error,
|
|
);
|
|
expect(result, isA<FileAccessUnavailable>());
|
|
expect((result as FileAccessUnavailable).error, same(error));
|
|
expect(result.stack.toString(), isNotEmpty);
|
|
});
|
|
}
|
|
}
|