test(persistence): Add tests for channel dao
Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
@@ -21,20 +21,17 @@ class SharedDB {
|
||||
static Future<VmDatabase> constructDatabase(
|
||||
String userId, {
|
||||
bool logStatements = false,
|
||||
bool persistOnDisk = true,
|
||||
}) async {
|
||||
final dbName = 'db_$userId';
|
||||
if (persistOnDisk) {
|
||||
if (Platform.isIOS || Platform.isAndroid) {
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
final path = join(dir.path, '$dbName.sqlite');
|
||||
final file = File(path);
|
||||
return VmDatabase(file, logStatements: logStatements);
|
||||
}
|
||||
if (Platform.isMacOS || Platform.isLinux) {
|
||||
final file = File('$dbName.sqlite');
|
||||
return VmDatabase(file, logStatements: logStatements);
|
||||
}
|
||||
if (Platform.isIOS || Platform.isAndroid) {
|
||||
final dir = await getApplicationDocumentsDirectory();
|
||||
final path = join(dir.path, '$dbName.sqlite');
|
||||
final file = File(path);
|
||||
return VmDatabase(file, logStatements: logStatements);
|
||||
}
|
||||
if (Platform.isMacOS || Platform.isLinux) {
|
||||
final file = File('$dbName.sqlite');
|
||||
return VmDatabase(file, logStatements: logStatements);
|
||||
}
|
||||
return VmDatabase.memory(logStatements: logStatements);
|
||||
}
|
||||
|
||||
@@ -10,7 +10,6 @@ class SharedDB {
|
||||
static Future<DelegatedDatabase> constructDatabase(
|
||||
String userId, {
|
||||
bool logStatements = false,
|
||||
bool persistOnDisk = true,
|
||||
}) {
|
||||
throw UnsupportedError(
|
||||
'No implementation of the constructDatabase api provided');
|
||||
|
||||
@@ -12,7 +12,6 @@ class SharedDB {
|
||||
static Future<WebDatabase> constructDatabase(
|
||||
String userId, {
|
||||
bool logStatements = false,
|
||||
bool persistOnDisk = true, // ignored on web
|
||||
}) async {
|
||||
final dbName = 'db_$userId';
|
||||
return WebDatabase(dbName, logStatements: logStatements);
|
||||
|
||||
Reference in New Issue
Block a user