- 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>
39 lines
1.3 KiB
TypeScript
39 lines
1.3 KiB
TypeScript
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);
|
|
});
|
|
});
|