first commmit

This commit is contained in:
jakciehan
2026-05-06 08:17:32 +08:00
commit 427a33c55b
269 changed files with 20906 additions and 0 deletions
+71
View File
@@ -0,0 +1,71 @@
import {
DESIGN_WIDTH,
DESIGN_HEIGHT,
TARGET_FPS,
MOVE_SPEED,
PlayerColorState,
JUMP_HEIGHT_STANDARD,
JUMP_HEIGHT_CHARGED,
JUMP_HEIGHT_YELLOW,
JUMP_PREPARE_DELAY_MS,
PARABOLIC_ANGLE_RIGHT,
PARABOLIC_ANGLE_LEFT,
SHURIKEN_INTERVAL_BASE,
SHURIKEN_INTERVAL_UPGRADED,
SWORD_INTERVAL,
PERF_TOUCH_RESPONSE_MAX_MS,
PERF_COMBO_RECOGNITION_MAX_MS,
STORAGE_KEY,
} from '@common/Constants';
describe('Constants — requirement baseline values', () => {
it('uses 960x540 landscape baseline (req tech-stack)', () => {
expect(DESIGN_WIDTH).toBe(960);
expect(DESIGN_HEIGHT).toBe(540);
expect(DESIGN_WIDTH / DESIGN_HEIGHT).toBeCloseTo(16 / 9, 3);
});
it('locks target frame rate at 30 fps (req 18.1-18.3)', () => {
expect(TARGET_FPS).toBe(30);
});
it('assigns 100/100/150 px/s move speeds per color state (req 5.1-5.2)', () => {
expect(MOVE_SPEED[PlayerColorState.Red]).toBe(100);
expect(MOVE_SPEED[PlayerColorState.Green]).toBe(100);
expect(MOVE_SPEED[PlayerColorState.Yellow]).toBe(150);
});
it('uses 250/375/300 jump heights (req 2.2-2.3)', () => {
expect(JUMP_HEIGHT_STANDARD).toBe(250);
expect(JUMP_HEIGHT_CHARGED).toBe(375);
expect(JUMP_HEIGHT_YELLOW).toBe(300);
});
it('reserves ~150ms crouch delay before leaving ground (req 2.8)', () => {
expect(JUMP_PREPARE_DELAY_MS).toBe(150);
});
it('parabolic angles anchored at 45° and 135° (req 2.5)', () => {
expect(PARABOLIC_ANGLE_RIGHT).toBe(45);
expect(PARABOLIC_ANGLE_LEFT).toBe(135);
});
it('weapon intervals conform to 0.3/0.25/0.5s (req 3.4/3.6)', () => {
expect(SHURIKEN_INTERVAL_BASE).toBe(0.3);
expect(SHURIKEN_INTERVAL_UPGRADED).toBe(0.25);
expect(SWORD_INTERVAL).toBe(0.5);
});
it('enforces <50ms touch and <100ms combo KPI thresholds (req 20.1/20.4)', () => {
expect(PERF_TOUCH_RESPONSE_MAX_MS).toBe(50);
expect(PERF_COMBO_RECOGNITION_MAX_MS).toBe(100);
});
it('defines all storage keys required by persistence (req 17 & 19.5)', () => {
expect(STORAGE_KEY.LevelUnlock).toBeDefined();
expect(STORAGE_KEY.ControlLayout).toBeDefined();
expect(STORAGE_KEY.AudioVolume).toBeDefined();
expect(STORAGE_KEY.TutorialDone).toBeDefined();
expect(STORAGE_KEY.StoryIntroSeen).toBeDefined();
});
});