mirror of
https://gitlab.com/foxixus/neomovies_mobile.git
synced 2025-10-28 05:58:50 +05:00
fix: Improve GitHub Actions workflows and add comprehensive tests
GitHub Actions improvements: - Fix release workflow to prevent draft releases on new workflow runs - Add automatic deletion of previous releases with same tag - Improve test workflow with torrent-engine-downloads branch support - Update Flutter version and add code generation step - Add Android lint checks and debug APK builds - Remove emoji from all workflow outputs for cleaner logs - Add make_latest flag for proper release versioning Test improvements: - Add comprehensive unit tests for TorrentInfo model - Add tests for FilePriority enum with comparison operators - Add DownloadsProvider tests for utility methods - Add widget tests for UI components and interactions - Test video file detection and main file selection - Test torrent state detection (downloading, paused, completed) - Test byte formatting for file sizes and speeds All tests validate the torrent downloads functionality and ensure proper integration with Android engine.
This commit is contained in:
40
test/providers/downloads_provider_test.dart
Normal file
40
test/providers/downloads_provider_test.dart
Normal file
@@ -0,0 +1,40 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:neomovies_mobile/presentation/providers/downloads_provider.dart';
|
||||
|
||||
void main() {
|
||||
group('DownloadsProvider', () {
|
||||
late DownloadsProvider provider;
|
||||
|
||||
setUp(() {
|
||||
provider = DownloadsProvider();
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
provider.dispose();
|
||||
});
|
||||
|
||||
test('initial state is correct', () {
|
||||
expect(provider.torrents, isEmpty);
|
||||
expect(provider.isLoading, isFalse);
|
||||
expect(provider.error, isNull);
|
||||
});
|
||||
|
||||
test('formatSpeed formats bytes correctly', () {
|
||||
expect(provider.formatSpeed(1024), equals('1.0KB/s'));
|
||||
expect(provider.formatSpeed(1048576), equals('1.0MB/s'));
|
||||
expect(provider.formatSpeed(512), equals('512B/s'));
|
||||
expect(provider.formatSpeed(2048000), equals('2.0MB/s'));
|
||||
});
|
||||
|
||||
test('formatDuration formats duration correctly', () {
|
||||
expect(provider.formatDuration(Duration(seconds: 30)), equals('30с'));
|
||||
expect(provider.formatDuration(Duration(minutes: 2, seconds: 30)), equals('2м 30с'));
|
||||
expect(provider.formatDuration(Duration(hours: 1, minutes: 30, seconds: 45)), equals('1ч 30м 45с'));
|
||||
expect(provider.formatDuration(Duration(hours: 2)), equals('2ч 0м 0с'));
|
||||
});
|
||||
|
||||
test('provider implements ChangeNotifier', () {
|
||||
expect(provider, isA<ChangeNotifier>());
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user