fix: more complete log in username error messages

This commit is contained in:
fsylvain committed 2026-10-05 16:04:24 +02:00
1 parent 8ad3941f6d
commit d8f171b8cc
3 files changed
+37 -1

No files matched your search

+19
View File
@@ -133,6 +133,25 @@ describe('Validation errors — nothing is sent for a short username and an empt
})
})
describe('Validation errors — specific username messages', () => {
it.each([
['marta@example.com', 'Use your username, not your email address.'],
['a'.repeat(21), 'Use 20 characters or fewer.'],
])('explains why %s is rejected without calling the API', async (value, message) => {
const login = vi.fn(() => mockResponse(200))
const wrapper = await mountLogin('/login', {
'POST /v1/auth/login': login,
})
await wrapper.find('input[placeholder="Your username"]').setValue(value)
await wrapper.find('form').trigger('submit')
await flushPromises()
expect(login).not.toHaveBeenCalled()
expect(wrapper.text()).toContain(message)
})
})
describe('Submitting — fields and button are disabled while the request is in flight', () => {
it('disables the fields and shows the loading label', async () => {
let resolveLogin: (() => void) | null = null