Fix video controls, tag input and collection deletion
This commit is contained in:
@@ -139,6 +139,47 @@ void main() {
|
||||
'2');
|
||||
});
|
||||
|
||||
test('deleted collection stays deleted after repository reload', () async {
|
||||
final repository = CollectionRepository(databaseService, postRepository);
|
||||
final service = CollectionService(repository);
|
||||
final created = await service.createCollection('Temp', null) as Success;
|
||||
final item = post('collection-delete');
|
||||
|
||||
await service.addPostToCollection(created.data.id, item);
|
||||
await service.deleteCollection(created.data.id);
|
||||
|
||||
final reloadedService = CollectionService(
|
||||
CollectionRepository(databaseService, postRepository),
|
||||
);
|
||||
|
||||
expect((await reloadedService.getCollections() as Success).data, isEmpty);
|
||||
expect(
|
||||
(await reloadedService.getCollectionPosts(created.data.id) as Success)
|
||||
.data,
|
||||
isEmpty,
|
||||
);
|
||||
});
|
||||
|
||||
test('settings export keeps blacklist whitelist and smart rules', () async {
|
||||
final service = SettingsService(databaseService);
|
||||
await service.updateSettings(
|
||||
AppSettings.defaults.copyWith(
|
||||
blacklistedTags: ['blocked'],
|
||||
whitelistedTags: ['allowed'],
|
||||
smartBlacklistRules: ['provider:e621 score:<10'],
|
||||
),
|
||||
);
|
||||
|
||||
final exported = await service.exportSettingsToJson() as Success<String>;
|
||||
|
||||
expect(exported.data, contains('"blacklistedTags"'));
|
||||
expect(exported.data, contains('"blocked"'));
|
||||
expect(exported.data, contains('"whitelistedTags"'));
|
||||
expect(exported.data, contains('"allowed"'));
|
||||
expect(exported.data, contains('"smartBlacklistRules"'));
|
||||
expect(exported.data, contains('provider:e621 score:<10'));
|
||||
});
|
||||
|
||||
test('cache service prunes to max item count', () async {
|
||||
final service = CacheService(databaseService);
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:gel_rule_app/features/post/presentation/widgets/post_media_viewer.dart';
|
||||
|
||||
void main() {
|
||||
testWidgets('video error retry button invokes callback', (tester) async {
|
||||
var retried = false;
|
||||
|
||||
await tester.pumpWidget(
|
||||
MaterialApp(
|
||||
home: Scaffold(
|
||||
body: VideoErrorOverlay(
|
||||
message: 'network failed',
|
||||
onRetry: () => retried = true,
|
||||
),
|
||||
),
|
||||
),
|
||||
);
|
||||
|
||||
await tester.tap(find.text('Retry'));
|
||||
await tester.pump();
|
||||
|
||||
expect(retried, isTrue);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user