fix(test): 修复测试数据库 schema 和 Flutter 测试与屏幕重构的兼容性

- backend/testutil/setup.go: SQLite shops 表补充 business_hours 列
- stock_in_screen_test: 入库管理双 Tab 重构后,draft/pending 测试改为先切换到「入库审核」Tab
- stock_out_insufficient_stock_flow_test: Inventory 构造参数 productUnit→unit,补充必填 id
- inventory_repository_test: mock 数据改为平铺字段格式,补充必填 id
- docs: 新增 NAS + Gitea 部署文档(Runner 设置、Shadowrocket 中继说明)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
wangjia
2026-05-24 10:48:21 +08:00
parent b90a89790f
commit 9f94cc97b7
5 changed files with 290 additions and 10 deletions
+8 -9
View File
@@ -48,17 +48,16 @@ void main() {
(server) => server.reply(200, {
'data': [
{
'id': 1,
'warehouse_id': 1,
'warehouse_name': '主仓库',
'product_id': 1,
'warehouse': {'name': '主仓库'},
'product': {
'name': '五粮液',
'code': 'P001',
'spec': '500ml',
'unit': '',
'brand': '五粮液集团',
'min_stock': 10,
},
'product_name': '五粮液',
'product_code': 'P001',
'spec': '500ml',
'unit': '',
'brand': '五粮液集团',
'min_stock': 10,
'quantity': 50.0,
}
],
+28
View File
@@ -209,6 +209,10 @@ void main() {
await tester.pumpWidget(_buildApp(AsyncValue.data(result)));
await tester.pump();
// draft orders only appear in the "入库审核" tab (index 1)
await tester.tap(find.text('入库审核'));
await tester.pumpAndSettle();
expect(find.text('SI2024010001'), findsOneWidget);
expect(find.text('SI2024010002'), findsOneWidget);
expect(find.text('张家酒水'), findsOneWidget);
@@ -226,6 +230,10 @@ void main() {
await tester.pumpWidget(_buildApp(const AsyncValue.data(empty)));
await tester.pump();
// "新建入库审核单" button only appears in the "入库审核" tab (index 1)
await tester.tap(find.text('入库审核'));
await tester.pumpAndSettle();
expect(find.text('新建入库审核单'), findsOneWidget);
});
@@ -240,6 +248,10 @@ void main() {
await tester.pumpWidget(_buildApp(const AsyncValue.data(empty)));
await tester.pump();
// button only exists in the "入库审核" tab (index 1)
await tester.tap(find.text('入库审核'));
await tester.pumpAndSettle();
await tester.tap(find.text('新建入库审核单'));
await tester.pumpAndSettle();
@@ -258,6 +270,10 @@ void main() {
await tester.pumpWidget(_buildApp(AsyncValue.data(result)));
await tester.pump();
// draft orders only appear in the "入库审核" tab (index 1)
await tester.tap(find.text('入库审核'));
await tester.pumpAndSettle();
expect(find.text('提交'), findsOneWidget);
});
@@ -273,6 +289,10 @@ void main() {
await tester.pumpWidget(_buildApp(AsyncValue.data(result)));
await tester.pump();
// pending orders only appear in the "入库审核" tab (index 1)
await tester.tap(find.text('入库审核'));
await tester.pumpAndSettle();
expect(find.byKey(const Key('btn_approve_1')), findsOneWidget);
expect(find.byKey(const Key('btn_reject_1')), findsOneWidget);
});
@@ -308,6 +328,10 @@ void main() {
await tester.pumpWidget(_buildApp(AsyncValue.data(result)));
await tester.pump();
// pending orders only appear in the "入库审核" tab (index 1)
await tester.tap(find.text('入库审核'));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('btn_approve_1')));
await tester.pumpAndSettle();
@@ -330,6 +354,10 @@ void main() {
await tester.pumpWidget(_buildApp(AsyncValue.data(result)));
await tester.pump();
// pending orders only appear in the "入库审核" tab (index 1)
await tester.tap(find.text('入库审核'));
await tester.pumpAndSettle();
await tester.tap(find.byKey(const Key('btn_reject_1')));
await tester.pumpAndSettle();
@@ -101,11 +101,12 @@ class _FakeInventoryRepository extends InventoryRepository {
return const PageResult(
data: [
Inventory(
id: 1,
warehouseId: 1,
warehouseName: '主仓库',
productId: 1,
productName: '五粮液',
productUnit: '',
unit: '',
quantity: 1,
),
],