mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-08-26 12:52:40 +02:00
perf(library): stream scans and optimize queue queries
This commit is contained in:
@@ -22,6 +22,16 @@ DownloadHistoryItem _historyItem({
|
||||
|
||||
void main() {
|
||||
group('download history identity', () {
|
||||
test('serializes download timestamps with an explicit UTC offset', () {
|
||||
final item = _historyItem(
|
||||
id: 'utc',
|
||||
filePath: '/music/Album/Same Song.flac',
|
||||
downloadedAt: DateTime(2026, 7, 22, 12, 30),
|
||||
);
|
||||
|
||||
expect(item.toJson()['downloadedAt'], endsWith('Z'));
|
||||
});
|
||||
|
||||
test('same track metadata does not merge files from different albums', () {
|
||||
final first = _historyItem(
|
||||
id: 'first',
|
||||
|
||||
@@ -167,4 +167,25 @@ void main() {
|
||||
expect(results.single['status'], 'found');
|
||||
expect(results.single['relative_dir'], 'Artist/Album');
|
||||
});
|
||||
|
||||
test('iOS bookmark access releases the matching native lease', () async {
|
||||
final calls = <MethodCall>[];
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(backendChannel, (call) async {
|
||||
calls.add(call);
|
||||
if (call.method == 'startAccessingIosBookmark') {
|
||||
return {'path': '/music', 'token': 'lease-1'};
|
||||
}
|
||||
if (call.method == 'stopAccessingIosBookmark') return null;
|
||||
fail('Unexpected method: ${call.method}');
|
||||
});
|
||||
|
||||
final access = await PlatformBridge.startAccessingIosBookmark('bookmark');
|
||||
expect(access?.path, '/music');
|
||||
expect(access?.token, 'lease-1');
|
||||
await PlatformBridge.stopAccessingIosBookmark(access!);
|
||||
|
||||
expect(calls[1].method, 'stopAccessingIosBookmark');
|
||||
expect(calls[1].arguments, {'token': 'lease-1'});
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user