Prepare game updates and single-process PM2 deployment

This commit is contained in:
2026-10-14 19:13:36 +09:00
parent 4f24129e29
commit 22792bc2b4
50 changed files with 1546 additions and 197 deletions
+22
View File
@@ -0,0 +1,22 @@
import assert from 'node:assert/strict';
import test from 'node:test';
import { DEFAULT_GLOBAL_SETTINGS } from '../constants/global-settings.js';
import { createMatchEngine } from '../src/shared/match-engine.js';
import { matchIntroductionDuration, matchIntroductionMessage } from '../src/shared/match-introduction.js';
for (const ranked of [false, true]) test(`configurable introduction preserves preparation and first turn (ranked: ${ranked})`, () => {
let now = 0;
const settings = { ...DEFAULT_GLOBAL_SETTINGS, matchingDelayMs: 4000, matchSuccessDelayMs: 2000, matchPreparationDelayMs: 5000 };
const engine = createMatchEngine({ matchId: 'intro', mode: 'friend', selfIndex: 0, clock: { now: () => now }, settings });
engine.start(matchIntroductionDuration(settings, ranked));
const message = () => matchIntroductionMessage({ ...engine.view(), ranked }, now);
assert.equal(message(), ranked ? '랭킹대전 매칭 중…' : '친구 대전 매칭 성공!');
if (ranked) { now = 4000; assert.equal(message(), '랭킹대전 매칭 성공!'); }
now += 2000;
assert.equal(message(), ranked ? '랭킹대전 준비 중…' : '친구 대전 준비 중…');
assert.equal(engine.beginTurn(), false);
now += 5000;
assert.equal(engine.beginTurn(), true);
assert.equal(message(), undefined);
assert.equal(engine.view().deadline - now, settings.turnDurationMs);
});