test: bring the test suite up to date, and let it run on Windows

The smoke, features, account and qol tests had fallen behind the server
and failed before reaching their end. Each now checks what the server
does on purpose today:

- harness: the chat filter messages the server sends unasked ("xfl"
  after every login, "xfa" on the first room) are set aside like "zs".
- smoke: a banned account's sign-in is refused with "account_banned", so
  the login-choices check uses a fresh account instead of the banned Carol.
- features: a shop's name comes from its room file, read the first time
  anyone goes in (the first visitor sees a name made from the path). A
  scout goes in first until the file is read, so the check no longer
  depends on what an earlier run left in cache/.
- account: a deleted account's name is held for NAME_HELD_DAYS, so taking
  it again right away is "username_taken".
- qol: the commands page sets what to type in italics.

And on Windows: withServer waits for the server process to exit before
removing its data directory, and retries; the database stays locked until
the process is gone, and the cleanup's EPERM hid the test's own result.

All seven test files pass (smoke, features, account, qol, buddygames,
restored, and staff in the next commit).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
SnipzilandClaude Opus 5.5 committed 2026-10-16 22:42:36 -04:00
1 parent edca7bf790
commit 63dc43ebb3
5 files changed
+46 -9

No files matched your search

+7 -5
View File
@@ -621,14 +621,16 @@ const run = async () => {
// --- the custom client's login choices: honoured for that session only
assert.strictEqual((await (await fetch(`${BASE}/flashvars`)).json()).loginChoices, true);
const chosen = await (await postJson(`${BASE}/authenticate`, {username: "Carol", password: "Password03",
// (a fresh account: Carol is banned by now, and a banned account's
// sign-in is refused with "account_banned", so it gets no token.)
assert.strictEqual((await registerJson({username: "Erin", password: "Password05"})).status, 200);
const chosen = await (await postJson(`${BASE}/authenticate`, {username: "Erin", password: "Password05",
login_choices: {accountType: 0, isGuide: true, membershipDays: 12, isModerator: "yes"}})).json();
// (Carol is banned from the game by now, so only the web side is checked.)
assert.strictEqual((await (await fetch(`${BASE}/player`, {headers: {Authorization: `Bearer ${chosen.auth_token}`}})).json()).game_account_type, 0);
a.xt("ag", denId, "Carol", 0);
a.xt("ag", denId, "Erin", 0);
assert.deepStrictEqual((await a.untilXt("ag")).slice(5, 7), ["0", "1"]); // account type, guide
await postJson(`${BASE}/authenticate`, {username: "Carol", password: "Password03"}); // and back to normal
a.xt("ag", denId, "Carol", 0);
await postJson(`${BASE}/authenticate`, {username: "Erin", password: "Password05"}); // and back to normal
a.xt("ag", denId, "Erin", 0);
assert.deepStrictEqual((await a.untilXt("ag")).slice(5, 7), ["2", "0"]);
// --- custom colours: an id for four RGB values, announced to everyone