testLoopbackTakesOnlyItsOwnAnswer
The loopback server takes only its own sign-in's answer: anything else is turned away, and it goes on waiting.
import { loopbackServer } from "#codebase/tcmts/atproto"; import assert from "node:assert/strict"; export const testLoopbackTakesOnlyItsOwnAnswer = async () => { const back = await loopbackServer(5000, "the-state"); try { const at = (q: string) => fetch(`http://127.0.0.1:${back.port}/callback?${q}`); assert.equal((await at("state=other&error=access_denied")).status, 400); assert.equal((await at("state=the-state&code=c1")).status, 200); assert.equal((await back.answer).get("code"), "c1"); } finally { back.close(); } }