{"draft":null,"from":59,"to":60,"files":[{"path":"client/test/box.test.ts","added":58,"removed":0,"diff":"--- a/client/test/box.test.ts\n+++ b/client/test/box.test.ts\n@@ -102,6 +102,64 @@\n \tassert.equal(JSON.stringify(boxPublic(got)).includes(CREDENTIAL), false);\n });\n \n+test(\"login opens the approve page with the code in it, and prints the link and code all the same\", async () => {\n+\tconst said: string[] = [];\n+\tconst opened: string[] = [];\n+\tconst c = clock();\n+\tawait login(\n+\t\tSERVER,\n+\t\t{\n+\t\t\tfetch: server(\n+\t\t\t\t[\n+\t\t\t\t\t[200, started],\n+\t\t\t\t\t[200, { box_id: \"b_0123abcd\", box_token: CREDENTIAL, expires_at: EXPIRES, grant }],\n+\t\t\t\t],\n+\t\t\t\t[],\n+\t\t\t),\n+\t\t\tsleep: c.sleep,\n+\t\t\tnow: c.now,\n+\t\t\tsay: (line) => said.push(line),\n+\t\t\topen: (url) => (opened.push(url), true),\n+\t\t},\n+\t\thome(),\n+\t);\n+\tassert.deepEqual(opened, [\"https://abso.dev/login/box?code=WXYZ-BCDF\"]);\n+\tassert.deepEqual(said.slice(0, 2), [\n+\t\t\"Opening the approve page in your browser.\",\n+\t\t\"To sign this box in, open https://abso.dev/login/box?code=WXYZ-BCDF and approve the code WXYZ-BCDF.\",\n+\t]);\n+});\n+\n+test(\"an open that doesn't start says nothing about a browser, and the printed link stands\", async () => {\n+\tconst said: string[] = [];\n+\tconst c = clock();\n+\tawait login(\n+\t\tSERVER,\n+\t\t{\n+\t\t\tfetch: server(\n+\t\t\t\t[\n+\t\t\t\t\t[200, started],\n+\t\t\t\t\t[200, { box_id: \"b_0123abcd\", box_token: CREDENTIAL, expires_at: EXPIRES, grant }],\n+\t\t\t\t],\n+\t\t\t\t[],\n+\t\t\t),\n+\t\t\tsleep: c.sleep,\n+\t\t\tnow: c.now,\n+\t\t\tsay: (line) => said.push(line),\n+\t\t\topen: () => false,\n+\t\t},\n+\t\thome(),\n+\t);\n+\tassert.equal(\n+\t\tsaid[0],\n+\t\t\"To sign this box in, open https://abso.dev/login/box?code=WXYZ-BCDF and approve the code WXYZ-BCDF.\",\n+\t);\n+\tassert.equal(\n+\t\tsaid.some((l) => l.includes(\"browser\")),\n+\t\tfalse,\n+\t);\n+});\n+\n test(\"a code that's turned down or runs out says so and keeps nothing\", async () => {\n \tconst h = home();\n \tconst c = clock();"}],"unmatched":[]}