Replace the free-text harvest year with a themed month/year picker: a tappable field opens a green-styled dialog with month and year grids (navigable, paginated years), month optional. Lots now read e.g. "September 2021" or just "Year 2021". - schema v3: add nullable Lot.harvest_month (1..12) + migration + tests - repo/cubit propagate harvestMonth; localized month names (en/es) via slang
41 lines
1.1 KiB
Dart
41 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();
|
|
},
|
|
);
|
|
}
|