From 321980c95b24a9f9c32a634fc2a58881e59ba15a Mon Sep 17 00:00:00 2001 From: Maurice Date: Fri, 27 Nov 2026 20:56:33 +0100 Subject: [PATCH] test(login): build the sign-in page's own config shape in the app screen tests --- client/src/pages/login/AppLogin.test.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/client/src/pages/login/AppLogin.test.tsx b/client/src/pages/login/AppLogin.test.tsx index 8db7ab9d8..3f10469bb 100644 --- a/client/src/pages/login/AppLogin.test.tsx +++ b/client/src/pages/login/AppLogin.test.tsx @@ -9,6 +9,12 @@ import AppLogin from './AppLogin'; import type { useLogin } from './useLogin'; type Login = ReturnType; +type LoginConfig = NonNullable; + +/** The sign-in page's own config shape, on top of the shared factory's. */ +function appConfigOf(overrides: Partial = {}): LoginConfig { + return { ...buildAppConfig({ has_users: true }), setup_complete: true, ...overrides } as LoginConfig; +} vi.mock('../../native/platform', async (importOriginal) => ({ ...(await importOriginal()), @@ -38,7 +44,7 @@ function buildLogin(overrides: Partial = {}): Login { error: '', setError: vi.fn(), insecureCookie: false, - appConfig: buildAppConfig({ has_users: true }), + appConfig: appConfigOf(), inviteToken: '', langDropdownOpen: false, setLangDropdownOpen: vi.fn(), @@ -127,7 +133,7 @@ describe('AppLogin', () => { it('FE-LOGIN-APP-004: offers SSO beside the password, carrying the remember-me choice', () => { const login = buildLogin({ rememberMe: false, - appConfig: buildAppConfig({ + appConfig: appConfigOf({ has_users: true, oidc_configured: true, oidc_login: true, @@ -148,7 +154,7 @@ describe('AppLogin', () => { login={buildLogin({ oidcOnly: true, inviteToken: 'abc', - appConfig: buildAppConfig({ has_users: true, oidc_display_name: 'Authentik' }), + appConfig: appConfigOf({ has_users: true, oidc_display_name: 'Authentik' }), })} /> ); @@ -161,7 +167,7 @@ describe('AppLogin', () => { it('FE-LOGIN-APP-006: offers a passkey where the server allows one', () => { const login = buildLogin({ - appConfig: buildAppConfig({ has_users: true, passkey_login: true, passkey_configured: true }), + appConfig: appConfigOf({ has_users: true, passkey_login: true, passkey_configured: true }), }); render(); fireEvent.click(screen.getByRole('button', { name: 'Sign in with a passkey' }));