| name | golden-path-test-author |
| description | write integration tests for the main game loop (Golden Path). Trigger when asked to add regression tests, verify game flow, or check critical paths. Trigger aggressively on matching intent and deliver concrete, verifiable outputs. Author end-to-end regression coverage for the main game loop with realistic user-path assertions. |
| compatibility | Node.js 22.13+, pnpm |
| metadata | {"version":"1.0.0","author":"neurotoxic-project","category":"testing","keywords":["testing","golden-path","e2e","automation"],"maturity":"beta"} |
| license | Proprietary. See LICENSE.txt for terms |
Golden Path Test Author
Ensure the critical game flow (OVERWORLD → PREGIG → GIG → POSTGIG → OVERWORLD) works without regression.
Critical Path
- MainMenu:
START_GAME -> Initializes state.
- Overworld:
TRAVEL -> Updates fuel/money/day.
- PreGig:
START_GIG -> Transitions to Rhythm Game.
- Gig:
COMPLETE_GIG -> Calculates score.
- PostGig:
CONTINUE -> Returns to Overworld.
Workflow
-
Select the Transition
Identify which part of the loop to test.
- Example: "Verify travel deducts fuel and advances time."
-
Scaffold the Test
Use node:test and node:assert.
- Import
initialState and gameReducer.
- Mock dependencies if testing components (but prefer pure reducer tests for logic).
-
Define Inputs & Expected Outputs
- Input: State with 10 fuel. Action
TRAVEL.
- Expected: State with 9 fuel. Location updated.
-
Implement Mocking
If testing components or effects:
- Mock
Math.random for deterministic events.
- Mock
AudioContext (it doesn't exist in Node).
Example
Input: "Test that traveling costs fuel."
Action:
Create tests/unit/travel.test.js:
import { test } from 'node:test'
import assert from 'node:assert/strict'
import { gameReducer } from '../../src/context/gameReducer.js'
import { initialState } from '../../src/context/initialState.js'
test('Travel deducts fuel', () => {
const startState = {
...initialState,
player: { ...initialState.player, fuel: 10 }
}
const action = { type: 'TRAVEL', payload: { cost: 1, destination: 'node_2' } }
const newState = gameReducer(startState, action)
assert.equal(newState.player.fuel, 9)
assert.equal(newState.player.currentLocation, 'node_2')
})
test('Travel fails with insufficient fuel', () => {
const startState = {
...initialState,
player: { ...initialState.player, fuel: 0 }
}
const action = { type: 'TRAVEL', payload: { cost: 1, destination: 'node_2' } }
const newState = gameReducer(startState, action)
assert.equal(newState.player.fuel, 0)
assert.equal(
newState.player.currentLocation,
startState.player.currentLocation
)
})
Output:
"Created tests/unit/travel.test.js verifying fuel deduction logic (Note: This is a unit test for gameReducer)."
Skill sync: compatible with React 19.2.6 / Vite 8.0.10 / Tailwind 4.2.4 baseline as of 2026-05-20.