已完成用户APP首期功能开发
交付用户端首期页面、配套接口、后台资源及测试文档。用户APP构建、静态分析和三个管理后台构建通过;完整测试仍有2项失败,后端模型注释检查未通过,详见交付记录。
This commit is contained in:
48
apps/user_app/test/data/gas_contracts_test.dart
Normal file
48
apps/user_app/test/data/gas_contracts_test.dart
Normal file
@@ -0,0 +1,48 @@
|
||||
// 功能描述:合同列表类型、会话隔离及真实状态回归;版本:1.0.0。
|
||||
import 'dart:convert';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:http/testing.dart';
|
||||
import 'package:user_app/data/repositories/client_repository.dart';
|
||||
import 'package:user_app/data/services/api_client.dart';
|
||||
|
||||
void main() {
|
||||
test('合同草稿保持真实状态并拦截跨会话迟到响应', () async {
|
||||
var token = 'first';
|
||||
var changeSession = false;
|
||||
final repo = ClientRepository(
|
||||
ApiClient(
|
||||
() => token,
|
||||
client: MockClient((request) async {
|
||||
expect(request.url.path.endsWith('/gas/contracts'), isTrue);
|
||||
if (changeSession) token = 'second';
|
||||
return http.Response(
|
||||
jsonEncode({
|
||||
'code': 0,
|
||||
'details': [
|
||||
{
|
||||
'identity': 'c1',
|
||||
'contract_no': 'HT1',
|
||||
'title': '合同',
|
||||
'terms': '条款',
|
||||
'contract_status': 0,
|
||||
'station_name': '气站',
|
||||
'has_attachment': false,
|
||||
'signed_at': '0001-01-01T00:00:00Z',
|
||||
},
|
||||
],
|
||||
}),
|
||||
200,
|
||||
headers: {'content-type': 'application/json; charset=utf-8'},
|
||||
);
|
||||
}),
|
||||
),
|
||||
);
|
||||
final contracts = await repo.gasContracts();
|
||||
expect(contracts.single.statusName, '草稿');
|
||||
expect(contracts.single.signedAt, isNull);
|
||||
expect(contracts.single.stationName, '气站');
|
||||
changeSession = true;
|
||||
await expectLater(repo.gasContracts(), throwsA(isA<SessionExpiredException>()));
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user