Skip to content

Commit 44cf83e

Browse files
committed
setup-test.js -> .ts
1 parent e1c693f commit 44cf83e

File tree

3 files changed

+6
-52
lines changed

3 files changed

+6
-52
lines changed

CLAUDE.md

Lines changed: 4 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,13 @@
22

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

5-
## Development Commands
6-
7-
### Running the application
5+
## Useful Commands
86

97
```bash
10-
npm run dev # Start dev server on http://localhost:8080
11-
npm run dev:e2e # Start dev server in e2e mode for Cypress tests
12-
npm run build # Build for production (runs tsc + vite build)
13-
```
8+
npm test # Run all Vitest unit tests (runs with TZ=UTC)
9+
npm test -- <pattern> # Run specific test file(s) matching pattern
1410

15-
### Testing
16-
17-
```bash
18-
npm test # Run all Vitest unit tests (runs with TZ=UTC)
19-
npm test -- <pattern> # Run specific test file(s) matching pattern
20-
npm run test:e2e # Start dev server and open Cypress for e2e tests
21-
npm run cypress:open # Open Cypress (dev server must be running)
22-
```
23-
24-
### Code Quality
25-
26-
```bash
27-
npm run lint # Run Oxlint on src/**/*.{js,jsx,ts,tsx}
11+
npm run lint -- --type-check # Run linter and tsc simultaneously
2812
```
2913

3014
### Directory Structure
@@ -33,13 +17,6 @@ npm run lint # Run Oxlint on src/**/*.{js,jsx,ts,tsx}
3317
src/
3418
├── api/ # SWR hooks and API functions (91 files)
3519
├── components/ # Reusable UI components
36-
│ ├── billing/
37-
│ ├── charts/
38-
│ ├── events/
39-
│ ├── saves/
40-
│ ├── tables/
41-
│ ├── toast/
42-
│ └── toggles/
4320
├── constants/ # App constants (routes, nav, user types)
4421
├── entities/ # TypeScript types and Zod schemas (29 domain models)
4522
├── modals/ # Modal dialog components
@@ -48,8 +25,6 @@ src/
4825
├── state/ # Recoil atoms (8 state files)
4926
├── styles/ # CSS files
5027
├── utils/ # Utilities and custom hooks
51-
│ ├── group-rules/
52-
│ └── validation/
5328
├── App.tsx # Main app component (handles auth and routing)
5429
├── Router.tsx # Route definitions with lazy loading
5530
└── index.tsx # App entry point
@@ -73,25 +48,9 @@ src/
7348
- `gamesState` - User's games list
7449
- `organisationState` - Organization data
7550
- `devDataState` - Dev data inclusion flag
76-
- State consumed via `useRecoilValue()`, `useRecoilState()`, `useSetRecoilState()`
77-
78-
### Data fetching
79-
80-
1. **SWR hooks** (23 hooks): Pattern is `use{Entity}(game, params)` returning `{ data, loading, error }`
81-
- Examples: `useEvents`, `useLeaderboards`, `useStats`
82-
- Uses `makeValidatedGetRequest()` for Zod validation
83-
- Automatic caching, revalidation, and deduplication
84-
85-
2. **Mutation functions** (68 functions): Named after action (e.g., `createLeaderboard`, `updatePlayer`)
86-
- Uses `makeValidatedRequest()` wrapper for Zod validation
87-
- Returns validated, typed responses
8851

8952
### Authorization
9053

9154
- Route-level checks with `canViewPage()` in Router
9255
- Action-level checks with `canPerformAction()` throughout components
9356
- Based on user type (ADMIN, OWNER, DEV, DEMO)
94-
95-
## Git Workflow
96-
97-
Main branch for PRs: `develop`
Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
11
import '@testing-library/jest-dom'
22

3-
globalThis.IS_REACT_ACT_ENVIRONMENT = true
4-
53
process.env.VITE_API_URL = 'http://talo.api'

vite.config.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ export default defineConfig({
1010
},
1111
test: {
1212
watch: false,
13-
globals: true,
14-
environment: 'jsdom',
15-
setupFiles: './setup-tests.js',
1613
css: false,
1714
coverage: {
1815
reporter: 'lcov',
@@ -30,7 +27,7 @@ export default defineConfig({
3027
name: 'unit',
3128
globals: true,
3229
environment: 'jsdom',
33-
setupFiles: './setup-tests.js',
30+
setupFiles: './setup-tests.ts',
3431
include: ['src/**/__tests__/**/*.test.{ts,tsx}'],
3532
exclude: ['src/utils/__tests__/convertDateToUTC.test.ts'],
3633
},
@@ -40,7 +37,7 @@ export default defineConfig({
4037
name: 'tz',
4138
globals: true,
4239
environment: 'jsdom',
43-
setupFiles: './setup-tests.js',
40+
setupFiles: './setup-tests.ts',
4441
include: ['src/utils/__tests__/convertDateToUTC.test.ts'],
4542
env: { TZ: 'America/Los_Angeles' },
4643
},

0 commit comments

Comments
 (0)