FPI 랭킹 내 행성·내 국가 판정 · 콜드 스타트 약관 깜빡임 · 로그아웃 상한
This commit is contained in:
@@ -455,9 +455,11 @@ void main() {
|
||||
},
|
||||
'createdAt': DateTime(2026, 9, 1, 0),
|
||||
});
|
||||
// 내 행성 · 내 국가는 가입 목록과 사용자 프로필에서 읽는다.
|
||||
await db.doc('users/$_uid/memberships/bts').set({'fandomId': 'bts'});
|
||||
await db.doc('users/$_uid').set({'countryCode': 'KR'}, SetOptions(merge: true));
|
||||
await db.doc('fandoms/bts/members/$_uid').set({
|
||||
'nickname': '나',
|
||||
// 국가 랭킹의 「나의 랭킹 영역」이 읽는 비정규화 국가 코드.
|
||||
'countryCode': 'KR',
|
||||
'topPercentByAxis': {'bpm': 3, 'health': 12},
|
||||
'fpiAxes': {'bpm': 2740, 'referral': 3180},
|
||||
@@ -582,6 +584,32 @@ void main() {
|
||||
expect(ranking.mine!.change, 1);
|
||||
});
|
||||
|
||||
test('미가입 행성에서 연 랭킹은 그 행성이 아니라 내 대표 행성을 「나」로 둔다 — 10/6 C-7', () async {
|
||||
final db = await seedPlanet();
|
||||
// nj 는 가입하지 않은 행성이다. 대표 행성은 bts(users.fandomId).
|
||||
final ranking = await FirestorePlanetRepository(_backend(db), fandomId: 'nj')
|
||||
.planetRanking(metric: FpiMetric.bpm);
|
||||
expect(ranking.rows.where((r) => r.isMine).map((r) => r.id), ['bts']);
|
||||
expect(ranking.mine!.id, 'bts');
|
||||
// 국가는 보고 있는 행성의 멤버 문서가 아니라 내 프로필 국가다.
|
||||
await db.doc('rankings/country-bpm').set({
|
||||
'rows': [{'code': 'KR', 'value': 1, 'change': 0}],
|
||||
});
|
||||
final country = await FirestorePlanetRepository(_backend(db), fandomId: 'nj')
|
||||
.countryRanking(metric: FpiMetric.bpm);
|
||||
expect(country.mine!.id, 'KR');
|
||||
});
|
||||
|
||||
test('가입한 행성이 하나도 없으면 「나」 행이 없다', () async {
|
||||
final db = await seedPlanet();
|
||||
await db.doc('users/$_uid/memberships/bts').delete();
|
||||
await db.doc('users/$_uid').update({'fandomId': ''});
|
||||
final ranking = await FirestorePlanetRepository(_backend(db), fandomId: 'nj')
|
||||
.planetRanking(metric: FpiMetric.bpm);
|
||||
expect(ranking.rows.any((r) => r.isMine), isFalse);
|
||||
expect(ranking.mine, isNull);
|
||||
});
|
||||
|
||||
test('랭킹은 마지막 갱신 시각과 갱신 주기를 함께 준다 — 별첨 1 ② 예외처리', () async {
|
||||
final db = await seedPlanet();
|
||||
final at = DateTime.utc(2026, 10, 7, 3, 4);
|
||||
|
||||
Reference in New Issue
Block a user