Phase 0: Project setup for agent-driven development
- Phaser 3 + bitECS 0.4 + TypeScript + Vite stack - BootScene with title screen - 6 cursor rules (project context, agent workflow, ECS, chemistry, Phaser, data) - Vitest configured with happy-dom - GDD, engine analysis, implementation plan, progress tracking Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
38
tests/setup.test.ts
Normal file
38
tests/setup.test.ts
Normal file
@@ -0,0 +1,38 @@
|
||||
import { describe, it, expect } from 'vitest';
|
||||
|
||||
describe('Project Setup', () => {
|
||||
it('should have working test infrastructure', () => {
|
||||
expect(1 + 1).toBe(2);
|
||||
});
|
||||
|
||||
// Phaser requires Canvas API — verified in browser via Playwright, not in unit tests
|
||||
it.skip('should import Phaser types (browser-only)', async () => {
|
||||
const Phaser = await import('phaser');
|
||||
expect(Phaser).toBeDefined();
|
||||
});
|
||||
|
||||
it('should import bitECS 0.4 API', async () => {
|
||||
const { createWorld, addEntity, addComponent, query } = await import('bitecs');
|
||||
expect(createWorld).toBeTypeOf('function');
|
||||
expect(addEntity).toBeTypeOf('function');
|
||||
expect(addComponent).toBeTypeOf('function');
|
||||
expect(query).toBeTypeOf('function');
|
||||
});
|
||||
|
||||
it('should create ECS world and entities', async () => {
|
||||
const { createWorld, addEntity, addComponent, query } = await import('bitecs');
|
||||
|
||||
const Position = { x: [] as number[], y: [] as number[] };
|
||||
const world = createWorld();
|
||||
const eid = addEntity(world);
|
||||
|
||||
addComponent(world, eid, Position);
|
||||
Position.x[eid] = 10;
|
||||
Position.y[eid] = 20;
|
||||
|
||||
const entities = query(world, [Position]);
|
||||
expect(entities).toContain(eid);
|
||||
expect(Position.x[eid]).toBe(10);
|
||||
expect(Position.y[eid]).toBe(20);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user