54 lines
1.6 KiB
Dart
54 lines
1.6 KiB
Dart
import 'package:flutter/cupertino.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:forge/src/rust/api/packages.dart';
|
|
import 'package:forge/src/services/batch_install_service.dart';
|
|
import 'package:forge/src/services/catalog_service.dart';
|
|
|
|
void main() {
|
|
group('BatchInstallService Tests', () {
|
|
test('Correctly identifies package IDs and separates backends', () {
|
|
final batch = BatchInstallService.instance;
|
|
batch.clear();
|
|
|
|
final vlc = CatalogApp(
|
|
id: 'vlc',
|
|
name: 'VLC Media Player',
|
|
summary: 'Media player',
|
|
category: 'Media',
|
|
backend: BackendType.pacman,
|
|
fallbackIcon: CupertinoIcons.play,
|
|
);
|
|
|
|
final vscode = CatalogApp(
|
|
id: 'visual-studio-code-bin',
|
|
name: 'Visual Studio Code',
|
|
summary: 'IDE',
|
|
category: 'Development',
|
|
backend: BackendType.aur,
|
|
fallbackIcon: CupertinoIcons.chevron_left_slash_chevron_right,
|
|
);
|
|
|
|
final bottles = CatalogApp(
|
|
id: 'com.usebottles.bottles',
|
|
name: 'Bottles',
|
|
summary: 'Wine prefix manager',
|
|
category: 'Utilities',
|
|
backend: BackendType.flatpak,
|
|
fallbackIcon: CupertinoIcons.tuningfork,
|
|
);
|
|
|
|
batch.add(vlc);
|
|
batch.add(vscode);
|
|
batch.add(bottles);
|
|
|
|
expect(batch.count, 3);
|
|
expect(batch.pacmanApps.first.id, 'vlc');
|
|
expect(batch.aurApps.first.id, 'visual-studio-code-bin');
|
|
expect(batch.flatpakApps.first.id, 'com.usebottles.bottles');
|
|
|
|
batch.clear();
|
|
expect(batch.isEmpty, isTrue);
|
|
});
|
|
});
|
|
}
|