mirror of
https://github.com/austinried/subtracks.git
synced 2026-02-10 15:02:42 +01:00
bring in database
switch to just using source models (no extra db fields) start re-implementing sync service
This commit is contained in:
10
test/util/database.dart
Normal file
10
test/util/database.dart
Normal file
@@ -0,0 +1,10 @@
|
||||
import 'package:drift/drift.dart';
|
||||
import 'package:drift/native.dart';
|
||||
import 'package:subtracks/database/database.dart';
|
||||
|
||||
SubtracksDatabase testDatabase() => SubtracksDatabase(
|
||||
DatabaseConnection(
|
||||
NativeDatabase.memory(),
|
||||
closeStreamsSynchronously: true,
|
||||
),
|
||||
);
|
||||
6
test/util/http.dart
Normal file
6
test/util/http.dart
Normal file
@@ -0,0 +1,6 @@
|
||||
import 'package:http/http.dart';
|
||||
|
||||
class TestHttpClient extends BaseClient {
|
||||
@override
|
||||
Future<StreamedResponse> send(BaseRequest request) => request.send();
|
||||
}
|
||||
34
test/util/subsonic.dart
Normal file
34
test/util/subsonic.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
import 'package:subtracks/sources/subsonic/client.dart';
|
||||
import 'package:test/test.dart';
|
||||
|
||||
import 'http.dart';
|
||||
|
||||
enum Servers {
|
||||
navidrome,
|
||||
gonic,
|
||||
}
|
||||
|
||||
Map<Servers, SubsonicClient> testServerClients() => {
|
||||
Servers.navidrome: SubsonicClient(
|
||||
http: TestHttpClient(),
|
||||
address: Uri.parse('http://localhost:4533/'),
|
||||
username: 'admin',
|
||||
password: 'password',
|
||||
),
|
||||
Servers.gonic: SubsonicClient(
|
||||
http: TestHttpClient(),
|
||||
address: Uri.parse('http://localhost:4747/'),
|
||||
username: 'admin',
|
||||
password: 'admin',
|
||||
),
|
||||
};
|
||||
|
||||
void groupByTestServer(void Function(SubsonicClient client) callback) {
|
||||
final clients = testServerClients();
|
||||
|
||||
for (final MapEntry(key: server, value: client) in clients.entries) {
|
||||
group(server.name, () {
|
||||
callback(client);
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user