Add POST /me/join and a join card: accounts survive a world reset
Found while resetting the live test world: joinWorld's comment promised POST /worlds/:id/join but no route existed, so after reset-world (accounts kept) nobody could found a POP again. Added POST /me/join (default: first running world; 409 if already joined), a join card on the POP screen, en/nb strings, API.md + openapi. Client no longer polls /movements while it has no operator (that 404ed). Tested: npm test 209/209 (new test/me-join.test.js incl. response contract), openapi check, npm run e2e (new check: account without a POP sees the join card and founds one). NOT tested: joining a second/other world (only the default-world path in the browser), nb text of the card visually. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q2MJaQ5LXAHzGnTDgceT14
This commit is contained in:
parent
bf7af0679c
commit
9104480463
9 changed files with 170 additions and 6 deletions
16
e2e/run.js
16
e2e/run.js
|
|
@ -155,6 +155,22 @@ async function suiteDesktop(browser, S) {
|
|||
P.base = S.base;
|
||||
await coreFlow(P, 'desktop', false, true);
|
||||
await P.ctx.close();
|
||||
|
||||
// An account that lost its operator (world reset) sees a join card and gets a POP with one click.
|
||||
const u = await S.signup('rejoin' + Date.now() % 1e5);
|
||||
S.db.run('DELETE FROM buildings WHERE town_id = ?', u.townId);
|
||||
S.db.run('DELETE FROM towns WHERE owner_id = ?', u.operatorId);
|
||||
S.db.run('DELETE FROM operators WHERE id = ?', u.operatorId);
|
||||
const J = await L.newPage(browser, PROFILES.desktop);
|
||||
await J.page.addInitScript((tok) => { try { localStorage.setItem('upstream.token', tok); } catch (e) { /* ignore */ } }, u.token);
|
||||
await J.page.goto(S.base + '/#/pop');
|
||||
await check('desktop: account without a POP sees the join card and founds one', async () => {
|
||||
await J.page.waitForSelector('[data-screen="pop"] .btn.primary', { timeout: 15000 });
|
||||
await J.page.click('[data-screen="pop"] .btn.primary');
|
||||
await J.page.waitForSelector('.town-name', { timeout: 15000 });
|
||||
return noErrors(J);
|
||||
});
|
||||
await J.ctx.close();
|
||||
}
|
||||
|
||||
async function suitePhone(browser, S) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue