1차 보완(0.1.1+14) 내용 합치기

This commit is contained in:
Sn-Kinos
2026-10-16 17:58:55 +09:00
62 changed files with 2480 additions and 447 deletions
+21 -1
View File
@@ -87,7 +87,11 @@ beforeEach(async () => {
}
const events = await db().collection(`fandoms/${FANDOM}/fpiEvents`).get();
await Promise.all(events.docs.map((d) => d.ref.delete()));
await db().doc(`users/${UID}`).set({ uid: UID, fandomId: FANDOM, totalContributedPop: 0 });
await db().doc(`users/${UID}`).set({
uid: UID, fandomId: FANDOM, totalContributedPop: 0,
// 위치 Quest 인증은 위치기반 서비스 동의가 있어야 한다(Q-E1 · R02). 동의 자체는 아래 별도 시험이 본다.
consentState: { location: { granted: true, version: 'v1' } },
});
// 운영값은 문서로 둔다 — 코드에 박으면 회신마다 재배포다(설계서 §10).
await db().doc('config/policy').set({
attendPop: 10, stepsGoal: 10_000, stepsPop: 50, adRewardPop: 10, adMultiplier: 2, adDailyLimit: 5,
@@ -459,6 +463,22 @@ describe('방문 — S-H-PLACE (fn-quest-verify-place)', () => {
const inRange = { questId: PLACE_QUEST, placeId: PLACE, lat: 37.5564, lng: 126.9237 };
const farAway = { questId: PLACE_QUEST, placeId: PLACE, lat: 37.4979, lng: 127.0276 };
it('위치기반 서비스 동의가 없으면 좌표를 처리하지 않고 E-PERM-01 (Q-E1 · R02)', async () => {
await db().doc(`users/${UID}`).update({ consentState: FieldValue.delete() });
expect(await codeOf(() => call(fnQuestVerifyPlace, inRange))).toBe('E-PERM-01');
expect((await db().collection(`users/${UID}/activityLogs`).get()).size).toBe(0);
// 철회 상태도 마찬가지다.
await db().doc(`users/${UID}`).update({ consentState: { location: { granted: false, version: 'v1' } } });
expect(await codeOf(() => call(fnQuestVerifyPlace, inRange))).toBe('E-PERM-01');
expect((await db().collection(`users/${UID}/popTransactions`).get()).size).toBe(0);
});
it('예전 가입 화면에서 위치 약관에 동의한 사용자는 다시 묻지 않는다', async () => {
await db().doc(`users/${UID}`).update({ consentState: FieldValue.delete(), termsVersion: 'draft-1' });
await db().doc(`users/${UID}/consents/location_draft-1_grant`).set({ docType: 'location', granted: true });
expect((await call(fnQuestVerifyPlace, inRange)).rewarded).toBe(100);
});
it('반경 밖이면 거부하고 거리를 증거에 남긴다', async () => {
expect(await codeOf(
() => call(fnQuestVerifyPlace, { ...farAway, proofKind: 'qr', proof: 'tok-far' }),