feat(flutter): 增加轮播自动播放与站内通知
This commit is contained in:
1 parent
b7b1c50427
commit
b870956665
24 files changed
+1398
-26
No files matched your search
@@ -0,0 +1,52 @@
|
||||
// Author: fruit.com.cn
|
||||
|
||||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:fruitshorts/core/data/remote/api_client.dart';
|
||||
import 'package:fruitshorts/core/data/remote/notice_api.dart';
|
||||
|
||||
import '../support/fake_http_adapter.dart';
|
||||
|
||||
void main() {
|
||||
test('should_parse_notice_page_with_string_ids_when_requested', () async {
|
||||
final adapter = FakeHttpAdapter(
|
||||
(_) async => FakeHttpResponse(
|
||||
jsonEncode({
|
||||
'code': 0,
|
||||
'message': 'ok',
|
||||
'data': {
|
||||
'total': '3',
|
||||
'list': [
|
||||
{
|
||||
'id': '2111012753262120962',
|
||||
'title': 'Maintenance',
|
||||
'content': 'Line one\nLine two',
|
||||
'type': 'SYSTEM',
|
||||
'publishAt': '2026-10-17T12:30:00',
|
||||
'expireAt': null,
|
||||
},
|
||||
],
|
||||
},
|
||||
}),
|
||||
),
|
||||
);
|
||||
final api = NoticeApi(
|
||||
ApiClient(baseUrl: 'http://127.0.0.1:8081', adapter: adapter),
|
||||
);
|
||||
|
||||
final page = await api.page(pageIndex: 2, pageSize: 20);
|
||||
|
||||
expect(adapter.requests.single.uri.path, '/app/notices');
|
||||
expect(adapter.requests.single.queryParameters, {
|
||||
'pageIndex': '2',
|
||||
'pageSize': '20',
|
||||
});
|
||||
expect(page.total, 3);
|
||||
expect(page.notices.single.id, '2111012753262120962');
|
||||
expect(page.notices.single.content, 'Line one\nLine two');
|
||||
expect(page.notices.single.type, 'SYSTEM');
|
||||
expect(page.notices.single.publishAt, DateTime(2026, 10, 17, 12, 30));
|
||||
expect(page.notices.single.expireAt, isNull);
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user