feat(boxing): support v2.5 dual modes
This commit is contained in:
@@ -190,8 +190,11 @@ void main() {
|
||||
expect(result.suggestedBoxNo, 4);
|
||||
});
|
||||
|
||||
test('saveBoxRecord parses zongpai number from success response', () async {
|
||||
test('saveBoxRecord sends simplified request body', () async {
|
||||
late Map<String, dynamic> body;
|
||||
final mockClient = _MockClient((request) async {
|
||||
final req = request as http.Request;
|
||||
body = jsonDecode(req.body) as Map<String, dynamic>;
|
||||
return http.Response(
|
||||
jsonEncode({
|
||||
'box_item_id': 102,
|
||||
@@ -212,15 +215,16 @@ void main() {
|
||||
zongpaiNo: '26BW0012',
|
||||
boxNo: 4,
|
||||
quantity: 34,
|
||||
boxMode: 'many-to-one',
|
||||
);
|
||||
|
||||
expect(result.success, isTrue);
|
||||
expect(result.boxItemId, 102);
|
||||
expect(result.zongpaiNo, '26BW0012');
|
||||
expect(body, {'zongpai_no': '26BW0012', 'box_no': 4, 'quantity': 34});
|
||||
expect(body.containsKey('box_mode'), isFalse);
|
||||
});
|
||||
|
||||
test('updateBoxRecord sends many-to-one box mode', () async {
|
||||
test('updateBoxRecord sends simplified request body', () async {
|
||||
late Map<String, dynamic> body;
|
||||
final mockClient = _MockClient((request) async {
|
||||
final req = request as http.Request;
|
||||
@@ -245,11 +249,11 @@ void main() {
|
||||
boxItemId: 102,
|
||||
boxNo: 4,
|
||||
quantity: 20,
|
||||
boxMode: 'many-to-one',
|
||||
);
|
||||
|
||||
expect(result.success, isTrue);
|
||||
expect(body['box_mode'], 'many-to-one');
|
||||
expect(body, {'box_no': 4, 'quantity': 20});
|
||||
expect(body.containsKey('box_mode'), isFalse);
|
||||
});
|
||||
|
||||
test('deleteBoxRecord handles success and not found', () async {
|
||||
|
||||
Reference in New Issue
Block a user