test: guest sign-in stays in the game (/signin)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -101,7 +101,7 @@ const spawnLib = require('../lib/spawn');
|
|||||||
eq((await hit('/r/nobody')).loc, '/', 'a share link for an unknown player goes to the landing page');
|
eq((await hit('/r/nobody')).loc, '/', 'a share link for an unknown player goes to the landing page');
|
||||||
const sh = await hit('/r/runner42'); eq([sh.status, sh.loc, sh.set.some(c => /^dr\.ref=runner42/.test(c))], [302, '/play', true], 'a player share link sets the referrer and opens the game');
|
const sh = await hit('/r/runner42'); eq([sh.status, sh.loc, sh.set.some(c => /^dr\.ref=runner42/.test(c))], [302, '/play', true], 'a player share link sets the referrer and opens the game');
|
||||||
let g = jarAdd('', sh.set);
|
let g = jarAdd('', sh.set);
|
||||||
const me401 = await hit('/api/me', {}, g); eq([me401.status, me401.body.guestOk, /join\/runner42\?from=driprunner/.test(me401.body.signin)], [401, true, true], 'a newcomer is offered guest play, sign-in goes through the sharer’s join link');
|
const me401 = await hit('/api/me', {}, g); eq([me401.status, me401.body.guestOk, me401.body.signin === '/signin'], [401, true, true], 'a newcomer is offered guest play, sign-in stays in the game (/signin; the kit carries the dr.ref sponsor)');
|
||||||
const gs = await hit('/api/guest', { method: 'POST', body: '{}' }, g); g = jarAdd(g, gs.set); eq(gs.status, 200, 'guest session starts');
|
const gs = await hit('/api/guest', { method: 'POST', body: '{}' }, g); g = jarAdd(g, gs.set); eq(gs.status, 200, 'guest session starts');
|
||||||
const gme = await hit('/api/me', {}, g); eq([gme.status, gme.body.me.guest, gme.body.player.chapter], [200, true, 1], 'guest plays chapter 1');
|
const gme = await hit('/api/me', {}, g); eq([gme.status, gme.body.me.guest, gme.body.player.chapter], [200, true, 1], 'guest plays chapter 1');
|
||||||
const gr = (await hit('/api/run/start', { method: 'POST', body: JSON.stringify({ W, H }) }, g)).body;
|
const gr = (await hit('/api/run/start', { method: 'POST', body: JSON.stringify({ W, H }) }, g)).body;
|
||||||
|
|||||||
Reference in New Issue
Block a user