diff --git a/test/index.js b/test/index.js index 266cdca..b44d03c 100644 --- a/test/index.js +++ b/test/index.js @@ -70,6 +70,29 @@ test ('reject invalid user', async (t) => { )); }); +test ('reject and recover', async (t) => { + await t.throwsAsync (client.login ( + 'testuser', + 'bar', + `http://localhost:${port}` + )); + + const session = await client.login ( + 'testuser', + 'foo', + `http://localhost:${port}` + ); + t.is (typeof session, 'string'); + + const resp = await fetch ( + `http://localhost:${port}`, + { headers: { session } } + ); + + t.is (resp.status, consts.http.status_ok); + t.is (await resp.text (), 'foo:69'); +}); + test ('reject invalid password', async (t) => { await t.throwsAsync (client.login ( 'testuser',