Files
vngeoguessr/CLAUDE.md
T
tiennm99 c2c1ced387 test: cover the lib layer against a fake and a real Redis
Scoring, the Upstash key adapter, sessions and the leaderboards had no
coverage, and they carry the anti-cheat model: server-held coordinates,
session TTLs, rank arithmetic.

One suite runs against two backing stores. By default @upstash/redis is
mocked with an in-memory fake, so `npm test` needs no service and
finishes well under a second. With TEST_REDIS=real the mock steps aside
and the same files run against a real Redis behind SRH, the proxy
Upstash recommends for local work, since the SDK speaks HTTP REST rather
than RESP and a plain Redis container cannot serve it alone.

Running both is what keeps the fake honest: a semantic it gets wrong
shows up as a green unit run and a red integration run. Two tests skip
against real Redis, one asserting a response shape only an older SDK
produces and one fast-forwarding half an hour to watch a session expire.

The suite was checked by mutation rather than by passing alone. Breaking
a score band, the key prefix and the session TTL each failed a test;
reversing the global trim window did not, because only the city
leaderboard was asserted, so that test now covers both scopes.

The compose stack doubles as a local Redis for `npm run dev`, which had
no credentials to reach one before.

package.json also loses the eight unused runtime dependencies removed in
the cleanup that follows; they cannot be split from the same file.
2026-08-30 09:26:02 +07:00

2.0 KiB

CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

Documentation

For detailed information about this project, refer to the documentation files in /docs/:

Quick Reference

Development Commands:

  • npm run dev - Start development server with Turbopack
  • npm run build - Build the application for production
  • npm start - Start production server
  • npm run lint - Run ESLint
  • npm test - Run tests against the in-memory Redis fake (no service needed)
  • npm run test:integration - Same tests against local Redis (npm run redis:up first)

Key Guidelines:

  • JavaScript Only: No TypeScript files (.ts, .tsx)
  • Function Parameters: Use individual parameters, not object destructuring
  • File Modifications: Only modify source code, /docs, and /plans
  • Security: Never expose secrets or keys
  • Testing: Run npm test for src/lib/ changes; inform user when complete - they handle manual testing of the UI

Critical Instructions

When working on this codebase, always:

  1. Read the relevant documentation files in /docs/ for context
  2. Follow the JavaScript-only approach with individual function parameters
  3. Maintain server-side security for game sessions and coordinates
  4. Use existing patterns and libraries already present in the codebase
  5. Highlight any configuration file changes for manual processing