timetracker/test/helpers/sqlite_test_helper.dart
2026-08-03 21:51:48 +02:00

16 lines
495 B
Dart

import 'dart:ffi';
import 'package:sqlite3/open.dart';
/// Call this in [setUpAll] for any test that uses a Drift NativeDatabase.
/// On Linux the unversioned `libsqlite3.so` symlink may be absent;
/// this falls back to the versioned `.so.0` that ships with the OS.
void configureSqliteForTests() {
open.overrideFor(OperatingSystem.linux, () {
try {
return DynamicLibrary.open('libsqlite3.so');
} catch (_) {
return DynamicLibrary.open('libsqlite3.so.0');
}
});
}