testing
Testing patterns for game client and server. Auto-applies when working with tests or implementing features that need testing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
菜单
Testing patterns for game client and server. Auto-applies when working with tests or implementing features that need testing.
用 Codex 或 Claude 帮你安装 复制这段 Prompt,粘贴到 Codex、Claude 或其他助手里,让它检查 Skill 页面并帮你完成安装。
基于 SOC 职业分类
Animate 3D objects and characters in Blender with Python. Use when the user wants to keyframe properties, create armatures and rigs, set up IK/FK chains, animate shape keys for facial animation, edit F-Curves, use the NLA editor to blend actions, add drivers for expression-based animation, or script any animation workflow in Blender.
Create 3D models procedurally with Blender Python. Use when the user wants to generate meshes from code, build geometry with bmesh, apply modifiers, create parametric shapes, procedural landscapes, grids, curves, or any programmatic 3D modeling in Blender.
Automate Blender compositing and post-processing with Python. Use when the user wants to set up compositor nodes, add post-processing effects, color correct renders, combine render passes, apply blur or glare, key green screens, create node-based VFX pipelines, or script the Blender compositor.
Automate Blender rendering from the command line. Use when the user wants to set up renders, batch render scenes, configure Cycles or EEVEE, set up cameras and lights, render animations, create materials and shaders, or build a render pipeline with Blender Python scripting.
Write and run Blender Python scripts for 3D automation. Use when the user wants to automate Blender tasks, run headless scripts, manipulate scenes, batch process .blend files, import/export 3D models, manage objects, or script Blender from the command line using the bpy API.
MongoDB database exploration for understanding game data, debugging, and investigation. Auto-applies when discussing database structure or debugging data issues.
| name | testing |
| description | Testing patterns for game client and server. Auto-applies when working with tests or implementing features that need testing. |
| allowed-tools | Bash, Read, Write, Edit, Grep, Glob |
Testing patterns for OpenCivilizations game.
client/
__tests__/ # Client-side tests
game/ # Game logic tests
ui/ # UI component tests
server/
__tests__/ # Server-side tests
rooms/ # Room logic tests
mechanics/ # Game mechanics tests
shared/
__tests__/ # Shared utility tests
# All tests
npm test
# Client tests only
npm run test:client
# Server tests only
npm run test:server
# Watch mode
npm run test:watch
# Specific test file
npm test -- path/to/test.spec.ts
import { calculateResources } from '../mechanics/resources';
describe('Resource Calculation', () => {
it('calculates gold production based on time elapsed', () => {
const player = { gold: 0, lastUpdate: Date.now() - 3600000 };
const farms = [{ productionRate: 10 }];
const result = calculateResources(player, farms);
expect(result.gold).toBe(10); // 1 hour * 10/hour
});
});
import { ColyseusTestServer } from '@colyseus/testing';
import { GameRoom } from '../rooms/GameRoom';
describe('GameRoom', () => {
let colyseus: ColyseusTestServer;
beforeAll(async () => {
colyseus = new ColyseusTestServer();
await colyseus.listen(2567);
});
afterAll(() => colyseus.shutdown());
it('creates building when player has resources', async () => {
const room = await colyseus.createRoom('game', {});
const client = await colyseus.connectTo(room);
client.send('build', { type: 'farm', x: 5, y: 5 });
await room.waitForNextPatch();
expect(room.state.buildings.length).toBe(1);
});
});
import { findPath } from '../systems/pathfinding';
describe('Pathfinding', () => {
it('finds path around obstacles', () => {
const grid = createGrid(10, 10);
grid[5][5].walkable = false; // obstacle
const path = findPath(grid, { x: 0, y: 0 }, { x: 9, y: 9 });
expect(path).not.toContain({ x: 5, y: 5 });
expect(path[path.length - 1]).toEqual({ x: 9, y: 9 });
});
});
import { cartesianToIsometric, isometricToCartesian } from '../utils/isometric';
describe('Isometric Conversion', () => {
it('converts cartesian to isometric and back', () => {
const cart = { x: 5, y: 3 };
const iso = cartesianToIsometric(cart.x, cart.y);
const result = isometricToCartesian(iso.x, iso.y);
expect(Math.round(result.x)).toBe(cart.x);
expect(Math.round(result.y)).toBe(cart.y);
});
});
Test scenarios come from story files:
docs/planning/stories/*.story.mdit('denies build when insufficient gold')