69 lines
1.6 KiB
Dart
69 lines
1.6 KiB
Dart
import 'dart:io';
|
|
|
|
import 'package:logging/logging.dart';
|
|
import 'package:mumbullet/src/config/config.dart';
|
|
import 'package:mumbullet/src/logging/logger.dart';
|
|
import 'package:mumbullet/src/mumble/connection.dart';
|
|
import 'package:test/test.dart';
|
|
|
|
void main() {
|
|
group('Integration tests', () {
|
|
late AppConfig config;
|
|
|
|
setUp(() {
|
|
final configPath = 'test_config.json';
|
|
final configFile = File(configPath);
|
|
|
|
if (!configFile.existsSync()) {
|
|
configFile.writeAsStringSync('''
|
|
{
|
|
"mumble": {
|
|
"server": "localhost",
|
|
"port": 64738,
|
|
"username": "TestBot",
|
|
"password": "testpass",
|
|
"channel": "Music"
|
|
},
|
|
"bot": {
|
|
"command_prefix": "!",
|
|
"default_permission_level": 0,
|
|
"max_queue_size": 50,
|
|
"cache_directory": "./test_cache",
|
|
"max_cache_size_gb": 5
|
|
},
|
|
"dashboard": {
|
|
"port": 8080,
|
|
"admin_username": "admin",
|
|
"admin_password": "changeme"
|
|
}
|
|
}
|
|
''');
|
|
}
|
|
|
|
config = AppConfig.fromFile(configPath);
|
|
|
|
// Set up logging
|
|
final logManager = LogManager.getInstance();
|
|
logManager.initialize(
|
|
level: Level.INFO,
|
|
logToConsole: true,
|
|
);
|
|
});
|
|
|
|
tearDown(() {
|
|
final testConfigFile = File('test_config.json');
|
|
if (testConfigFile.existsSync()) {
|
|
testConfigFile.deleteSync();
|
|
}
|
|
});
|
|
|
|
test('Config validation passes', () {
|
|
expect(() => config.validate(), returnsNormally);
|
|
});
|
|
|
|
test('Mumble connection creation', () {
|
|
final connection = MumbleConnection(config.mumble);
|
|
expect(connection, isNotNull);
|
|
});
|
|
});
|
|
} |