Files
HouseHoldKeaper/test/core/database/database_test.dart
Jean-Luc Makiola d2e452655c feat(02-01): Drift tables, DAOs, scheduling utility, domain models with tests
- Add Rooms, Tasks, TaskCompletions Drift tables with schema v2 migration
- Create RoomsDao with CRUD, watchAll, watchWithStats, cascade delete, reorder
- Create TasksDao with CRUD, watchInRoom (sorted by due), completeTask, overdue detection
- Implement calculateNextDueDate and catchUpToPresent pure scheduling functions
- Define IntervalType enum (8 types), EffortLevel enum, FrequencyInterval model
- Add formatRelativeDate German formatter and curatedRoomIcons icon list
- Enable PRAGMA foreign_keys in beforeOpen migration strategy
- All 30 unit tests passing (17 scheduling + 6 rooms DAO + 7 tasks DAO)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-15 21:50:12 +01:00

32 lines
742 B
Dart

import 'package:drift/native.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:household_keeper/core/database/database.dart';
void main() {
group('AppDatabase', () {
late AppDatabase db;
setUp(() {
db = AppDatabase(NativeDatabase.memory());
});
tearDown(() async {
await db.close();
});
test('opens successfully with in-memory executor', () {
expect(db, isNotNull);
});
test('has schemaVersion 2', () {
expect(db.schemaVersion, equals(2));
});
test('can be closed without error', () async {
await db.close();
// If we reach here, close succeeded. Re-create for tearDown.
db = AppDatabase(NativeDatabase.memory());
});
});
}