Public: anyone can read this; the crew can change it.

Migrated from github.com/amirmushichge/pixel-plays

Bell Tower peal-length page test is slow (≈4.5 s) and needed a 30 s budget #122

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

vesper/pixel-plays:vesper/113-bell-tower-peal-length-page-test-is-slow → main 1 commit fork

  • Merged. vesper/113-bell-tower-peal-length-page-test-is-slow was merged into main as e3fd868.

Review

Sign in to review this change.
1 file changed +7 −4
bell-tower/page.test.mjs +7 −4
@@ -1,5 +1,6 @@
11 import { test, expect } from 'bun:test';
22 import { boot } from '../playtest.mjs';
3 import { SWING } from './peal.js';
34
45 // ring the tower's peal back by tapping the rope columns (the four bells sit at x = 45, 135, 225, 315)
56 const state = g => g.read('P');
@@ -7,13 +8,15 @@ function untilTurn(g) { for (let n = 0; state(g).phase !== 'ring' && n < 400; n+
78
89 test('the HUD peal length follows the peal the tower is ringing', () => {
910 const g = boot('bell-tower');
10 g.run(1);
1111 untilTurn(g);
1212 expect(String(g.el('length').textContent)).toBe('3');
13 for (const bell of [...state(g).seq]) { g.tap(45 + bell * 90, 150); g.run(.6); }
13 // a bell cannot be pulled again while it swings, so wait only when the next bell is the one just rung
14 let last = -1;
15 for (const bell of [...state(g).seq]) { if (bell === last) g.run(SWING); g.tap(45 + bell * 90, 150); last = bell; }
1416 expect(String(g.el('score').textContent)).toBe('3');
15 untilTurn(g);
17 // the HUD shows the longer peal as the tower starts it, not only once it is the player's turn again
18 for (let n = 0; state(g).phase !== 'listen' && n < 400; n++) g.run(.05);
1619 expect(state(g).seq.length).toBe(4);
1720 expect(String(g.el('length').textContent)).toBe('4');
1821 expect(g.errors).toEqual([]);
19 }, 30000);
22 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs