mirror of
https://github.com/luxfi/quest.git
synced 2026-10-30 15:20:25 +00:00
The repo was a "coming soon" page. This is the game. A quest is a VALUE, not a database row — name, prize and every stop encode into the share link, so making one and sending it needs no account, no server and no storage. The code rides in the URL FRAGMENT, never the query string: a fragment is not sent to the server and does not appear in a Referer header, so the places someone chose stay out of access logs and off any site they click through to. `?q=` would quietly publish every quest anyone shares. Arriving is the one rule worth getting right. A stop is found when the device reports a position inside its radius, and the browser's own accuracy estimate is ADDED to that radius — a phone between tall buildings reports ±50 m, and holding it to the bare radius tells someone standing at the right door they are not there. Wildly inaccurate readings are capped, so a device claiming ±50 km cannot unlock a city from the sofa. Google is confined to one module. With no NEXT_PUBLIC_GOOGLE_MAPS_KEY every stop falls back to a list with a Maps link and the hunt is still playable, and "no key configured" is kept distinct from "Google refused" — collapsing those is how a missing env var gets mistaken for an outage. Prizes are the maker's own words, settled between the two people. Nothing here holds money or hands anything out; an escrow would be a custody problem and saying otherwise in the UI would be a lie about what happens when someone wins. Proven, not asserted: 28 unit tests over the pure core (unicode place names, truncated and hand-edited links returning null instead of throwing, coordinate precision against a 45 m radius, corrupt localStorage) and 7 Playwright tests driving the real static export at phone size with FAKED GPS — walk to Clarion Alley and the point lands, stand three blocks away and it does not, refuse location and the screen says so rather than doing nothing silently. Also fixes a pre-existing break: Tailwind was configured with no stylesheet importing it, so every utility class in the app was inert. Co-authored-by: Hanzo Dev <[email protected]>
17 lines
692 B
TypeScript
17 lines
692 B
TypeScript
import { defineConfig } from 'vitest/config'
|
|
|
|
export default defineConfig({
|
|
test: {
|
|
// The codec uses btoa/atob and progress uses localStorage — both are
|
|
// browser APIs, and both are exactly what these tests pin.
|
|
environment: 'happy-dom',
|
|
// Node 22's own experimental `localStorage` global takes the name before
|
|
// either DOM environment can install one, so window.localStorage is
|
|
// undefined under jsdom AND happy-dom. The setup file supplies a real
|
|
// Storage; see src/test-setup.ts for why that is the environment's fault
|
|
// and not the code's.
|
|
setupFiles: ['./src/test-setup.ts'],
|
|
include: ['src/**/*.test.ts', 'src/**/*.test.tsx'],
|
|
},
|
|
})
|