Photos: - Repository addPhoto/removePhoto; VarietyDetail.photos (list); loads all photos. - Detail: a 140×140 photo carousel with page dots, delete-current, and add-photo (gallery); empty state shows an add-photo button. - watchInventory now re-emits on attachment + species changes (StreamGroup), so a photo added on the detail screen refreshes the inventory avatar immediately (fixes avatars not updating). Also carries the concurrent harvest-date work: lots gain an optional harvest month (schemaVersion 3 + from2To3 migration, drift_schema_v3 exported), a month/year harvest picker, and localized month names. 48 tests green (add/remove photos, avatar reactivity, v1→v3 migration); Linux runs.
38 lines
1.1 KiB
Dart
38 lines
1.1 KiB
Dart
import 'package:drift_dev/api/migrations_native.dart';
|
|
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:tane/db/database.dart';
|
|
|
|
import 'schema/schema.dart';
|
|
|
|
void main() {
|
|
late SchemaVerifier verifier;
|
|
|
|
setUpAll(() {
|
|
verifier = SchemaVerifier(GeneratedHelper());
|
|
});
|
|
|
|
test('freshly created database matches the exported schema v3', () async {
|
|
final schema = await verifier.schemaAt(3);
|
|
final db = AppDatabase(schema.newConnection());
|
|
await verifier.migrateAndValidate(db, 3);
|
|
await db.close();
|
|
});
|
|
|
|
test('upgrades v1 → v3 (adds Lot.type, then harvestMonth) and matches the '
|
|
'fresh schema', () async {
|
|
final connection = await verifier.startAt(1);
|
|
final db = AppDatabase(connection);
|
|
await verifier.migrateAndValidate(db, 3);
|
|
await db.close();
|
|
});
|
|
|
|
test(
|
|
'upgrades v2 → v3 (adds Lot.harvestMonth) and matches the fresh schema',
|
|
() async {
|
|
final connection = await verifier.startAt(2);
|
|
final db = AppDatabase(connection);
|
|
await verifier.migrateAndValidate(db, 3);
|
|
await db.close();
|
|
},
|
|
);
|
|
}
|