feat: add alot
This commit is contained in:
@@ -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(
|
||||
|
||||
Reference in New Issue
Block a user