new plus button

This commit is contained in:
davmar
2026-08-31 09:40:38 +02:00
parent 3b698a3667
commit 92581e6d55
17 changed files with 1336 additions and 152 deletions
+8 -1
View File
@@ -4,7 +4,7 @@ import 'package:receipity/services/backup_format.dart';
void main() {
test('round-trips a backup document', () {
const original = BackupDocument(
version: 2,
version: 3,
exportedAt: '2026-08-29T12:00:00.000',
darkMode: true,
supermarkets: [
@@ -29,6 +29,7 @@ void main() {
{
'id': 8,
'supermarket': 'Jumbo',
'name': 'Weekly shop',
'shopped_at': '2026-08-29T12:00:00.000',
'receipt_image_path': 'receipts/shop_8.jpg',
'total': 1.5,
@@ -46,6 +47,9 @@ void main() {
'unit_price': 1.5,
},
],
shopTags: [
{'id': 1, 'shop_id': 8, 'tag': 'weekly', 'normalized_tag': 'weekly'},
],
shoppingLists: [
{
'id': 1,
@@ -71,7 +75,9 @@ void main() {
expect(parsed.darkMode, isTrue);
expect(parsed.products.single['name'], 'Milk');
expect(parsed.shops.single['id'], 8);
expect(parsed.shops.single['name'], 'Weekly shop');
expect(parsed.shopItems.single['product_id'], 1);
expect(parsed.shopTags.single['tag'], 'weekly');
expect(parsed.shoppingLists.single['name'], 'Weekly');
expect(parsed.shoppingListItems.single['name'], 'Milk');
expect(parsed.images['products/product_1.jpg'], 'abc123');
@@ -95,6 +101,7 @@ void main() {
expect(parsed.version, 1);
expect(parsed.shoppingLists, isEmpty);
expect(parsed.shoppingListItems, isEmpty);
expect(parsed.shopTags, isEmpty);
});
test('rejects a file that is not a Receipity backup', () {