правки по лаунчеру

This commit is contained in:
2026-07-28 20:43:53 +04:00
parent 155922a3f1
commit 0b6f7fc647
51 changed files with 3158 additions and 437 deletions
@@ -64,7 +64,7 @@ void main() {
.toList();
expect(statuses.last.stage, ClientSyncStage.completed);
expect(statuses.last.message, 'Client is up to date.');
expect(statuses.last.message, 'Клиент обновлён.');
expect(api.downloadedPaths, isEmpty);
expect(installationService.deletedRelativeFiles, isEmpty);
expect(logger.errorMessages, isEmpty);
@@ -139,7 +139,7 @@ void main() {
);
expect(installationService.deletedRelativeFiles, ['legacy.txt']);
expect(api.downloadedPaths, ['Wow.exe', 'Data/common.MPQ']);
expect(statuses.last.message, 'Client is ready to play.');
expect(statuses.last.message, 'Клиент готов к игре.');
expect(logger.errorMessages, isEmpty);
},
);
@@ -0,0 +1,24 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:moonwell_launcher/features/launcher/data/launcher_news_link.dart';
void main() {
test('builds public news URL from launcher base URL and news id', () {
expect(
buildLauncherNewsUri('http://localhost:8080', 4),
Uri.parse('http://localhost:8080/news/4'),
);
});
test('preserves a base URL path when building news URL', () {
expect(
buildLauncherNewsUri('https://example.com/moonwell', 7),
Uri.parse('https://example.com/moonwell/news/7'),
);
});
test('rejects invalid base URLs and news ids', () {
expect(buildLauncherNewsUri('', 4), isNull);
expect(buildLauncherNewsUri('not-a-url', 4), isNull);
expect(buildLauncherNewsUri('https://example.com', 0), isNull);
});
}
@@ -0,0 +1,13 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:moonwell_launcher/features/launcher/domain/entities/launcher_account.dart';
void main() {
test('LauncherAccount parses username without exposing balance', () {
final account = LauncherAccount.fromJson(<String, Object?>{
'username': 'PLAYERONE',
'balance': '1250.00',
});
expect(account.username, 'PLAYERONE');
});
}
@@ -0,0 +1,26 @@
import 'package:flutter_test/flutter_test.dart';
import 'package:moonwell_launcher/features/launcher/domain/entities/launcher_realm.dart';
void main() {
test('LauncherRealm parses launcher realms payload', () {
final realm = LauncherRealm.fromJson(<String, Object?>{
'id': 1,
'name': 'MoonWell',
'address': 'logon.moon-well.online',
'port': 8085,
'population': 0.5,
'game_build': 12340,
'online': true,
'status': 'online',
});
expect(realm.id, 1);
expect(realm.name, 'MoonWell');
expect(realm.address, 'logon.moon-well.online');
expect(realm.port, 8085);
expect(realm.population, 0.5);
expect(realm.gameBuild, 12340);
expect(realm.online, isTrue);
expect(realm.status, 'online');
});
}