From 7db3e0166a610b40c90848e3ced4a539be3574d5 Mon Sep 17 00:00:00 2001 From: Alice Gaudon Date: Sun, 15 Nov 2020 15:21:54 +0100 Subject: [PATCH] Authentication tests: fix Cannot register without username test --- test/Authentication.test.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/Authentication.test.ts b/test/Authentication.test.ts index 4f91abc..032e24a 100644 --- a/test/Authentication.test.ts +++ b/test/Authentication.test.ts @@ -197,18 +197,19 @@ describe('Register with email (magic_link)', () => { }); test('Cannot register without specifying username', async () => { - const res = await agent.get('/csrf').expect(200); + let res = await agent.get('/csrf').expect(200); const cookies = res.get('Set-Cookie'); const csrf = res.text; - await agent.post('/auth/register') + res = await agent.post('/auth/register') .set('Cookie', cookies) .send({ csrf: csrf, auth_method: 'magic_link', - identifier: 'glimmer@example.org', + identifier: 'no_user_name@example.org', }) .expect(400); + expect(res.body.messages?.name?.name).toStrictEqual('UndefinedValueValidationError'); expect(await popEmail()).toBeNull(); });