Passport Tier 팬덤 단위 · 활동 Badge · 진화 Emblem · Eclipse 참여 기록

This commit is contained in:
Sn-Kinos
2026-10-05 22:09:10 +09:00
parent 71ec17dc3c
commit cc0f2fb292
36 changed files with 877 additions and 81 deletions
@@ -76,3 +76,29 @@ it('내 활동은 호출자와 지급 당시 팬덤으로 제한하고 다른
await expect(call({ fandomId, scope: 'personal', cursor: 'other-fandom' })).rejects.toThrow();
await expect(call({ fandomId, scope: 'all-users' })).rejects.toThrow();
});
it('내 기록 첫 장에 PASSPORT Stamp(진화 Emblem · 최초 100명 · Eclipse 성공 참여)를 함께 준다', async () => {
const db = getFirestore();
const { recordEclipseSuccess } = await import('../src/fandom/fandom.js');
const round = db.doc(`fandoms/${fandomId}/eclipseRounds/r1`);
await round.collection('participants').doc(uid).set({ qualified: true, validShakes: 60 });
await round.collection('participants').doc('not-qualified').set({ qualified: false, validShakes: 10 });
expect(await recordEclipseSuccess(fandomId, round)).toBe(1);
expect(await recordEclipseSuccess(fandomId, round)).toBe(1);
expect((await db.collection(`users/${uid}/passportHistory`).get()).size).toBe(1);
expect((await db.doc(`users/not-qualified/passportHistory/eclipse_${fandomId}_r1`).get()).exists).toBe(false);
await db.doc(`users/${uid}/badges/evolution_${fandomId}_2`).set({
kind: 'evolution', fandomId, toStage: 2, awardedAt: Timestamp.fromMillis(50_000) });
await db.doc(`users/${uid}/badges/founder100_${fandomId}`).set({
kind: 'founder100', fandomId, memberNo: 7, awardedAt: Timestamp.fromMillis(1_000) });
await db.doc(`users/${uid}/badges/founder100_other`).set({
kind: 'founder100', fandomId: 'other', memberNo: 1, awardedAt: Timestamp.fromMillis(1_000) });
const result = await call({ fandomId, scope: 'personal' });
const kinds = result.items.map((item) => item.kind);
expect(kinds[0]).toBe('eclipse_success');
expect(kinds).toContain('emblem_evolution');
expect(kinds.filter((k) => k === 'badge_founder100')).toHaveLength(1);
// 팬덤 범위에는 섞지 않는다.
expect((await call({ fandomId })).items.every((item) => item.kind === 'evolution')).toBe(true);
await db.recursiveDelete(db.doc('users/not-qualified'));
});