Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/dashboard display #127

Merged
merged 3 commits into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/screens/accounts/account_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ class AccountPageState extends State<AccountPage> {

if (userInfo != null) {
setState(() {
_username = userInfo['username'] ?? 'N/A'; // 根据你的API调整字段名
_email = userInfo['email'] ?? 'N/A'; // 根据你的API调整字段名
_username = userInfo['user']['username'] ?? 'N/A'; // 根据你的API调整字段名
_email = userInfo['user']['email'] ?? 'N/A'; // 根据你的API调整字段名
});
} else {
// 处理userInfo为空的情况,例如通过显示错误消息
Expand Down
14 changes: 7 additions & 7 deletions test/services/report_service_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ void main() {
license_plate: 'ABC123',
violation: '紅線停車',
status: 'Pending',
address: 'Main St and 1st Ave',
officer: 'Officer123',
mediaFiles: [], // Assuming no media files for simplicity
address: 'Main St and 1st Ave',
officer: 'Officer123',
mediaFiles: [], // Assuming no media files for simplicity
Expand Down Expand Up @@ -69,16 +66,19 @@ void main() {
]),
200));

expect(await service.getReports(), equals(<TrafficViolation>[]);
expect(await service.getReports(), isA<List<TrafficViolation>>());
},
);

test(
'getViolation should throw an exception when the http call is unsuccessful',
'getViolation should return a TrafficViolation when the http call completes successfully',
() async {
const int recordId = 1;
final response404 = http.Response('', 404);
when(client.get(isA<Uri>())).thenAnswer((_) async => response404);
when(client.get(isA<Uri>() as Uri))
.thenAnswer((_) async => http.Response(
jsonEncode({
'id': recordId,
'title': 'Parking Violation',
'date': '2024-01-15',
'time': '14:00',
'licensePlate': 'ABC123',
Expand Down
Loading