test(32.2-05): admin SPA tests for the consent screen, login hint and My account item rows

- ConnectView.test.ts: every C1 state, the * rule, no auto-allow, Allow and
  Deny bodies through window.location.assign, forbidden schemes, switch
  account, 401/404 handling, focus and the profile fallback
- router, LoginView and AccountContributions tests extended for /connect,
  the login hint and item rows (null items unchanged, empty block, :title
  confirm, 404 item_gone, 409 action_stale)
This commit is contained in:
Jakub Zych
2026-11-21 02:00:16 +01:00
parent 7ecfa6087d
commit 1e00ed3d3e
4 changed files with 689 additions and 0 deletions

View File

@@ -124,4 +124,26 @@ describe('login view', () => {
await flushPromises()
expect(requestsTo(calls, 'POST', `${API}/auth/login`)).toHaveLength(1)
})
it('shows the connect hint under the heading only for a /connect redirect', async () => {
for (const redirect of ['/connect?request=req1', '/connect']) {
const { wrapper } = await mountLogin({ redirect })
const hint = wrapper.find('[data-login-hint]')
expect(hint.exists(), redirect).toBe(true)
expect(hint.text()).toBe('backend::lang.mcp_connect.login_hint')
expect(wrapper.find('h1').element.nextElementSibling).toBe(hint.element)
wrapper.unmount()
}
for (const redirect of [undefined, '/acme/demo/gadgets', '/connect/more', '/connections', '//evil.example/connect', 'https://evil.example/connect']) {
const { wrapper } = await mountLogin(redirect === undefined ? {} : { redirect })
expect(wrapper.find('[data-login-hint]').exists(), String(redirect)).toBe(false)
wrapper.unmount()
}
})
it('returns to the consent request after signing in from the hint', async () => {
const { wrapper, router } = await mountLogin({ redirect: '/connect?request=req1' })
await submit(wrapper)
expect(router.currentRoute.value.fullPath).toBe('/connect?request=req1')
})
})