Initial commit: CookIT recipe collection and week planner
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
commit
7d7a0bc60b
173 files changed
+22803
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import 'package:cookit/src/recipes/models/recipe.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
|
||||
void main() {
|
||||
test('unit keys round-trip through JSON, built-in or own', () {
|
||||
for (final key in ['gram', 'bunch', 'own-1234']) {
|
||||
final line = IngredientLine.fromJson(IngredientLine(amount: 1, unitKey: key, name: 'x').toJson());
|
||||
expect(line.unitKey, key);
|
||||
}
|
||||
});
|
||||
|
||||
test('scaled multiplies amount and range, keeps the rest', () {
|
||||
const line = IngredientLine(amount: 2, amountMax: 3, unitKey: 'tablespoon', name: 'Öl', remark: 'gutes');
|
||||
final half = line.scaled(0.5);
|
||||
expect((half.amount, half.amountMax, half.unitKey, half.name, half.remark), (1, 1.5, 'tablespoon', 'Öl', 'gutes'));
|
||||
expect(const IngredientLine(name: 'Salz').scaled(2).amount, isNull);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user