test: catch up with the 17 October update

- the buddy list and last-seen times ("bl", "xls") come unasked at login
- the den owner is sent the den's items on a switch
- a clothing gift goes by its picture's id; the shop page is the Item giver

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
SnipzilandClaude Opus 5.5 committed 2026-10-16 22:50:47 -04:00
1 parent ceda20ffc8
commit 57abc8746d
3 files changed
+12 -7

No files matched your search

+4 -1
View File
@@ -413,7 +413,10 @@ const run = async () => {
assert.deepStrictEqual([sent[2], sent[7], sent[8], sent[9]], ["2", "0", "1", hat]);
assert.deepStrictEqual((await a.nextXt("es")).slice(2), ["1"]);
const pushed = await b.untilXt("ep");
assert.deepStrictEqual(pushed.slice(3, 10), ["Ann", cards[9], stamps[9], "0", "A hat for you!", "1", shop[9]]);
// a clothing gift goes by the id of its picture (the def's layerDefId,
// lib/ecards.js giftId), not the item's
assert.deepStrictEqual(pushed.slice(3, 9), ["Ann", cards[9], stamps[9], "0", "A hat for you!", "1"]);
assert.ok(Number(pushed[9]) > 0);
b.xt("el", own[4], 0);
const inbox = await b.nextXt("el");
assert.deepStrictEqual([inbox[2], inbox.length], ["1", 3 + 17]);
+4 -3
View File
@@ -100,9 +100,10 @@ class GameClient {
this.varUpdates.push(fields);
continue;
}
// the chat filter settings ("xfl", after every login) and the one-time
// question which filter to use ("xfa", on the first room) come unasked.
if ((fields[0] === "xfl" || fields[0] === "xfa") && cmd !== fields[0]) {
// the chat filter settings ("xfl", after every login), the one-time
// question which filter to use ("xfa", on the first room) and the
// buddy list with when each was last seen ("bl", "xls": at login) come unasked.
if ((fields[0] === "xfl" || fields[0] === "xfa" || fields[0] === "bl" || fields[0] === "xls") && cmd !== fields[0]) {
continue;
}
if (this.unasked(fields)) {
+4 -3
View File
@@ -383,12 +383,13 @@ const run = async () => {
const moved = await c.nextXt("rp");
assert.deepStrictEqual([moved[4], moved[5]], ["2", newDenDef]); // room type 2 = den, then the den type
assert.deepStrictEqual((await c.nextXt("ds")).slice(2, 3), ["0"]); // the furniture stayed in the first den
assert.deepStrictEqual((await a.nextXt("ds")).slice(2, 3), ["0"]);
// the owner is also sent the den's items ("di") on a switch
assert.deepStrictEqual((await a.untilXt("ds")).slice(2, 3), ["0"]);
a.xt("dc", denId, 0);
await a.nextXt("dc");
await c.nextXt("rp");
assert.deepStrictEqual((await c.nextXt("ds")).slice(2, 3), ["1"]);
await a.nextXt("ds");
await a.untilXt("ds");
a.xt("dp", denId, 0, 0);
{
const stranger = new GameClient();
@@ -411,7 +412,7 @@ const run = async () => {
assert.deepStrictEqual([gone[2], gone[5], ...gone.slice(7)], ["2", "Alice", "0", "1", tradedInv]);
// --- item finder: search by name and id, give to a connected player
assert.match(await (await fetch(`${BASE}/shop`)).text(), /Item finder/);
assert.match(await (await fetch(`${BASE}/shop`)).text(), /Item giver/);
const found = await (await fetch(`${BASE}/api/search?q=top+hat&kind=clothing`)).json();
assert.ok(found.total > 0 && found.results.every(item => /top/i.test(item.name) && /hat/i.test(item.name)));
const hat = found.results[0];