feat(flyer-import): add detailed product signals and display names
- Added `signals` and `displayNameDetailed` fields to FlyerItem model in Prisma schema - Introduced `FlyerImportSignals` type with origin countries, labels, quality flags, variant, and packaging - Added `displayNameDetailed` field to FlyerImportItem DTO and Flutter model - Implemented utility functions for signal extraction and display name building - Updated flyer import service to persist and return signals/category data - Enhanced Flutter UI to display detailed product information including badges for signals - Added new test coverage for signals persistence and display name generation - Added new import-common module for shared import utilities - Created database migration for new fields - Added Kilo plan for feature development
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:recipe_flutter/features/import/domain/flyer_import_item.dart';
|
||||
|
||||
void main() {
|
||||
test('parses signals and detailed bundle name', () {
|
||||
final item = FlyerImportItem.fromJson({
|
||||
'flyerItemId': 7,
|
||||
'rawName': 'Kaptenens Favoriter',
|
||||
'displayNameDetailed':
|
||||
'Kaptenens Favoriter (Chumlax 3x100g + Alaska pollock 3x100g)',
|
||||
'normalizedName': 'kaptenens favoriter',
|
||||
'isBundle': true,
|
||||
'bundleItems': ['Chumlax 3x100g', 'Alaska pollock 3x100g'],
|
||||
'signals': {
|
||||
'originCountries': ['Sverige'],
|
||||
'labels': ['Ekologisk'],
|
||||
'qualityFlags': ['eco'],
|
||||
'variant': null,
|
||||
'packaging': 'multipack',
|
||||
},
|
||||
});
|
||||
|
||||
expect(item.isBundle, isTrue);
|
||||
expect(item.displayNameDetailed, contains('Chumlax 3x100g'));
|
||||
expect(item.bundleItems, hasLength(2));
|
||||
expect(item.signals?.originCountries, ['Sverige']);
|
||||
expect(item.toJson()['signals'], isA<Map<String, dynamic>>());
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user