feat: add alot

This commit is contained in:
2026-10-08 04:12:36 +02:00
parent ccf5165417
commit fc607cb7bd
99 changed files with 4981 additions and 3655 deletions
+6 -24
View File
@@ -1,41 +1,24 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:kooltab2/l10n/app_localizations.dart';
import 'package:kooltab2/models/bar_tab.dart';
import 'package:kooltab2/services/bar_tab_service.dart';
import 'package:kooltab2/services/product_service.dart';
import 'package:kooltab2/services/remote_sync_service.dart';
import 'package:kooltab2/viewmodels/bar_screen_view_model.dart';
import 'package:kooltab2/viewmodels/inventory_view_model.dart';
import 'package:kooltab2/viewmodels/remote_sync_view_model.dart';
import 'package:kooltab2/views/dialogs/edit_tab_dialog.dart';
import 'package:kooltap/l10n/app_localizations.dart';
import 'package:kooltap/models/bar_tab.dart';
import 'package:kooltap/services/bar_tab_service.dart';
import 'package:kooltap/viewmodels/bar_screen_view_model.dart';
import 'package:kooltap/views/dialogs/edit_tab_dialog.dart';
import 'package:mocktail/mocktail.dart';
import 'package:provider/provider.dart';
class MockBarTabService extends Mock implements BarTabService {}
class MockProductService extends Mock implements ProductService {}
class MockRemoteSyncService extends Mock implements RemoteSyncService {}
void main() {
testWidgets('edit dialog disposes its controller after closing', (
tester,
) async {
final barTabService = MockBarTabService();
final productService = MockProductService();
final remoteSyncViewModel = RemoteSyncViewModel(
syncService: MockRemoteSyncService(),
);
final viewModel = BarScreenViewModel(
barTabService: barTabService,
inventory: InventoryViewModel(productService: productService),
remoteSyncViewModel: remoteSyncViewModel,
);
final viewModel = BarScreenViewModel(barTabService: barTabService);
final tab = BarTab(
id: 'tab-1',
customerName: 'Before',
status: 'open',
openedAt: DateTime(2026),
items: const [],
);
@@ -43,7 +26,6 @@ void main() {
when(
() => barTabService.renameTab(tabId: 'tab-1', customerName: 'After'),
).thenAnswer((_) async {});
when(() => barTabService.getOpenTabs()).thenAnswer((_) async => [tab]);
await tester.pumpWidget(
ChangeNotifierProvider<BarScreenViewModel>.value(