mirror of
https://gitlab.com/foxixus/neomovies_mobile.git
synced 2025-10-28 03:58:50 +05:00
- Add test stage to GitLab CI with Flutter analyze and test commands - Add memory optimization flags for builds (split-debug-info, obfuscate) - Add pub-cache caching to improve build times - Fix broken tests by removing old torrent service tests and adding simple working test - Add missing Flutter imports to fix test compilation errors - Configure CI to run tests and builds efficiently while minimizing RAM usage
41 lines
1.4 KiB
Dart
41 lines
1.4 KiB
Dart
import 'package:flutter/foundation.dart';
|
||
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>());
|
||
});
|
||
});
|
||
} |