Refactor platform UI and data flow across core pages
All checks were successful
Build Org Website / build (push) Successful in 50s
All checks were successful
Build Org Website / build (push) Successful in 50s
This commit is contained in:
40
tests/princess-lima-polish.test.cjs
Normal file
40
tests/princess-lima-polish.test.cjs
Normal file
@@ -0,0 +1,40 @@
|
||||
const test = require("node:test");
|
||||
const assert = require("node:assert/strict");
|
||||
const fs = require("node:fs");
|
||||
const path = require("node:path");
|
||||
const data = require("../assets/scripts/pages/princess-lima-data.js");
|
||||
const intro = require("../assets/scripts/pages/princess-lima-intro.js");
|
||||
|
||||
const root = path.resolve(__dirname, "..");
|
||||
const rpgSource = fs.readFileSync(path.join(root, "play/rpg.org"), "utf8");
|
||||
|
||||
test("all nine regions have authored art data and valid collision-safe transitions", () => {
|
||||
const mapsSource = fs.readFileSync(path.join(root, "assets/scripts/pages/princess-lima-maps.js"), "utf8");
|
||||
data.MAP_IDS.forEach((region) => {
|
||||
assert.match(mapsSource, new RegExp(`${region}:\\s*\\{`));
|
||||
Object.values(data.MAPS[region].spawns).forEach((spawn) => {
|
||||
assert.ok(spawn.x > 0 && spawn.x < data.WIDTH);
|
||||
assert.ok(spawn.y > 0 && spawn.y < data.HEIGHT);
|
||||
});
|
||||
data.MAPS[region].exits.forEach((exit) => {
|
||||
assert.ok(data.MAPS[exit.target]);
|
||||
assert.ok(data.MAPS[exit.target].spawns[exit.spawn]);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
test("keyboard-only page contains one left HUD and no touch controls", () => {
|
||||
assert.match(rpgSource, /class="lima-hud"/);
|
||||
assert.match(rpgSource, /Inventory <kbd>I<\/kbd>/);
|
||||
assert.match(rpgSource, /Menu <kbd>M<\/kbd>/);
|
||||
assert.doesNotMatch(rpgSource, /data-lima-touch|data-lima-move|Touch controls|data-lima-attack/);
|
||||
});
|
||||
|
||||
test("opening cinematic is complete, replayable and accessible", () => {
|
||||
assert.equal(intro.BEATS.length, 5);
|
||||
assert.ok(intro.BEATS.reduce((total, beat) => total + beat.duration, 0) >= 60000);
|
||||
assert.ok(intro.BEATS.every((beat) => beat.subtitle.length > 20));
|
||||
assert.match(rpgSource, /data-lima-replay-intro/);
|
||||
assert.match(rpgSource, /data-lima-intro-pause/);
|
||||
assert.match(rpgSource, /Hold Escape to skip/);
|
||||
});
|
||||
Reference in New Issue
Block a user