퀘스트 목록 페이지 판정 · 다시 읽기 · 캠페인 응원 수를 고유 후원자 기준으로
This commit is contained in:
@@ -132,6 +132,31 @@ void main() {
|
||||
expect(find.text('12,290'), findsNothing);
|
||||
});
|
||||
|
||||
testWidgets('첫 10장이 모두 걸러져도 11번째 이후 퀘스트가 보인다 (2026-10-06 실기기)', (tester) async {
|
||||
await pumpWide(tester, QuestListScreen(repository: _PagedRepo()));
|
||||
await tester.pumpAndSettle();
|
||||
expect(find.text('열한 번째 퀘스트'), findsOneWidget);
|
||||
});
|
||||
|
||||
testWidgets('탭 전환 · 당겨서 새로고침이 목록을 다시 읽는다 (내 퀘스트 상태 · 2026-10-06 실기기)', (tester) async {
|
||||
final repo = _PagedRepo();
|
||||
await pumpWide(tester, QuestListScreen(repository: repo));
|
||||
await tester.pumpAndSettle();
|
||||
final before = repo.loads;
|
||||
await tester.tap(
|
||||
find.descendant(of: find.byType(QuestTabStrip), matching: find.text(QuestTab.mine.label)),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
expect(repo.loads, before + 1);
|
||||
await tester.tap(
|
||||
find.descendant(of: find.byType(QuestTabStrip), matching: find.text(QuestTab.all.label)),
|
||||
);
|
||||
await tester.pumpAndSettle();
|
||||
await tester.fling(find.text('열한 번째 퀘스트'), const Offset(0, 400), 1000);
|
||||
await tester.pumpAndSettle();
|
||||
expect(repo.loads, before + 3);
|
||||
});
|
||||
|
||||
testWidgets('목록 조회가 실패해도 로딩이 끝난다', (tester) async {
|
||||
await pumpWide(tester, QuestListScreen(repository: _FailingList()));
|
||||
await tester.pumpAndSettle();
|
||||
@@ -513,6 +538,34 @@ class _BalanceRepo extends SampleQuestRepository {
|
||||
Future<int?> popBalance() async => 12260;
|
||||
}
|
||||
|
||||
/// 첫 페이지 10장이 모두 감춰지는(보상완료 관리자) 표본 — 11번째가 다음 페이지에 있다.
|
||||
class _PagedRepo extends SampleQuestRepository {
|
||||
var loads = 0;
|
||||
|
||||
static QuestCard _hidden(int i) => QuestCard(
|
||||
id: 'h$i', title: '숨김 $i', categoryName: '출석', type: QuestType.attend,
|
||||
author: QuestAuthor.admin, stage: QuestStage.rewarded, goal: 1, progress: 1,
|
||||
rewardPop: 10, participants: 0,
|
||||
);
|
||||
|
||||
@override
|
||||
Future<List<QuestCard>> load({int limit = 10}) async {
|
||||
loads += 1;
|
||||
return [for (var i = 0; i < 10; i++) _hidden(i)];
|
||||
}
|
||||
|
||||
@override
|
||||
Future<List<QuestCard>> more({required int offset, int limit = 10}) async => offset >= 11
|
||||
? const []
|
||||
: const [
|
||||
QuestCard(
|
||||
id: 'u11', title: '열한 번째 퀘스트', categoryName: '건강', type: QuestType.steps,
|
||||
author: QuestAuthor.user, stage: QuestStage.notStarted, goal: 1, progress: 0,
|
||||
rewardPop: 10, participants: 0,
|
||||
),
|
||||
];
|
||||
}
|
||||
|
||||
/// 목록이 실패하는 표본 — 로딩이 끝나지 않으면 탭 전체가 무한 로딩이다.
|
||||
class _FailingList extends SampleQuestRepository {
|
||||
@override
|
||||
|
||||
Reference in New Issue
Block a user