Authentication tests: fix Cannot register without username test

This commit is contained in:
Alice Gaudon 2020-11-15 15:21:54 +01:00
parent 124bc8785f
commit 7db3e0166a

View File

@ -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();
});